Nicklas
(Fresh Scripter)
2010-08-12 03:17 PM
Rename file with date using "move"

Hi!

Trying to rename a file with the acctual date and time. Want it to look like this: "backup 2010-08-12.bkf"

 Code:
Move "H:\Backup\backup.bkf" "H:\Backup\backup @date.bkf" 

@date dosent seem to work, what have I done wrong?

/Nicklas


eriqjaffe
(Hey THIS is FUN)
2010-08-12 03:43 PM
Re: Rename file with date using "move"

Try it like this:

 Code:
Move Move "H:\Backup\backup.bkf" "H:\Backup\backup "+@date+".bkf"


Nicklas
(Fresh Scripter)
2010-08-12 04:06 PM
Re: Rename file with date using "move"

Thx for the tip, unfortunatly it dosnīt work. I guess you made a typo when you wrote "Move Move". Only shows a error on that row.

Writing this does not work either.
 Code:
 Move "H:\Backup\backup.bkf" "H:\Backup\backup "+@date+".bkf" 


If I remove the "+" todays date shows up on the screen, but it dosenīt save it to the file. Am I using the wrong command?
 Code:
Move "H:\Backup\backup.bkf" "H:\Backup\backup "@date".bkf" 


OS: Windows 2003
Kix Ver: 4.61.0.0


AllenAdministrator
(KiX Supporter)
2010-08-12 04:16 PM
Re: Rename file with date using "move"

You have to replace the "/"s with "-"s

try
with Kix 4.61
 Code:
 Move "H:\Backup\backup.bkf" "H:\Backup\backup " + replace(@date,"/","-") + ".bkf"


older kix
 Code:
 Move "H:\Backup\backup.bkf" "H:\Backup\backup " + join(split(@date,"/"),"-") + ".bkf"


Nicklas
(Fresh Scripter)
2010-08-12 04:30 PM
Re: Rename file with date using "move"

It worked!

thx alot!


Mart
(KiX Supporter)
2010-08-13 12:22 PM
Re: Rename file with date using "move"

@time and @date have invalid characters for file and folder names. In the date slashes and in the time remove the colon. Both are not allowed in file and folder names. You can also replace them with something else like Allen suggested.

Arend_
(MM club member)
2010-08-13 03:11 PM
Re: Rename file with date using "move"

Actually not. @TIME and @DATE are based on your regional setttings. If they contains slash separators then @TIME and @DATE will use those.

Mart
(KiX Supporter)
2010-08-13 05:08 PM
Re: Rename file with date using "move"

Yep. Sorry missed that one.

Richard H.Administrator
(KiX Supporter)
2010-08-13 05:09 PM
Re: Rename file with date using "move"

 Originally Posted By: apronk
Actually not. @TIME and @DATE are based on your regional setttings. If they contains slash separators then @TIME and @DATE will use those.


Is that right?

I don't have a system to check on, but the KiXtart manual states that the format for @DATE is "YYYY/MM/DD" and @TIME is "HH:MM:SS" and I understood that was the case, i.e. regional settings are ignored and the information is returned in a fixed format.


LonkeroAdministrator
(KiX Master Guru)
2010-08-14 03:44 PM
Re: Rename file with date using "move"

I have a system to check it on and yes, date always uses the weird, screwed up way of representing date.
at least it's not bad as US version that puts day in the middle.


AllenAdministrator
(KiX Supporter)
2010-08-14 06:15 PM
Re: Rename file with date using "move"

"Screwed up way" as it is in the manual or ...?

LonkeroAdministrator
(KiX Master Guru)
2010-08-14 06:20 PM
Re: Rename file with date using "move"

screwed up = not the way I like it ;\)

AllenAdministrator
(KiX Supporter)
2010-08-14 06:24 PM
Re: Rename file with date using "move"

lol... okay... so do you not like yyyy/mm/dd?

LonkeroAdministrator
(KiX Master Guru)
2010-08-14 10:58 PM
Re: Rename file with date using "move"

not as much as dd.mm.yyyy

it is easier to do [censored] with the kix way, but who actually uses that format irl?


LonkeroAdministrator
(KiX Master Guru)
2010-08-14 10:59 PM
Re: Rename file with date using "move"

lol. I got CENSORED!

NTDOCAdministrator
(KiX Master)
2010-08-14 11:40 PM
Re: Rename file with date using "move"

hehe you only like dd.mm.yyyy because that is what you're used to seeing in your Country.

The yyyy.mm.dd actually sorts properly as it belongs even without the automated sorting of XP/Vista/Win7


LonkeroAdministrator
(KiX Master Guru)
2010-08-15 12:25 AM
Re: Rename file with date using "move"

yes, it sorts nicely.
but kixtart uses yyyy/mm/dd
you can't use such formatting with files in wintosh machines.


Richard H.Administrator
(KiX Supporter)
2010-08-16 02:54 PM
Re: Rename file with date using "move"

Us ancient coders always use YYYYMMDD for dates (with or without seperators), it saves all the sort coding and problems with date confusion.

(Actually the *really* ancient coders used YYMMDD because it saved on data storage and finger wear on card punchers, but they learned their lesson in 2000 and as punishment had their leather arm patches ceremoniously removed and were made to have a hair-cut)

As a case in point, one of our SSL certificates expired on me on the 10th August and caused some minor havoc. Our documentation from the supplier clearly stated that the certificate was good until 8th October.

Wait a minute.... 10/08/2010 expired, 08/10/2010 should have expired. Doh! The curse of US vs European date confusion strikes again!

The problem with using DD/MM/YYYY or MM/DD/YYYY is that unless you have a reference point or the days > 12 there is no way to determine which format is being used. YYYY-MM-DD is well known and understood and reduces the opportunity for fubar.

And don't get me started on people who insist on using a 12 hour clock.


JochenAdministrator
(KiX Supporter)
2010-08-16 03:00 PM
Re: Rename file with date using "move"

 Originally Posted By: Richard H.
And don't get me started on people who insist on using a 12 hour clock.


Using 1pm rather than 13:00 ?! All the same, easy as pie :p


Glenn BarnasAdministrator
(KiX Supporter)
2010-08-16 03:53 PM
Re: Rename file with date using "move"

What!? There's only 12 hours? No wonder I can't get everything done in one day!

I actually use the Join(Split(@DATE, '/'), '') fairly often to add dates to my log files.. putting the date first, then "_logname.log" makes it very clear what time period the log entries represent.

Glenn


Richard H.Administrator
(KiX Supporter)
2010-08-16 04:19 PM
Re: Rename file with date using "move"

Hah! and noon is?

I've lost track of the number of times I've caught people out with 12:00 - is that AM or PM? Noon or Midnight.

Worse are the ones who send maintenance notices out for 08:00 and then crib afterwards that "Of course it meant 08:00 in the evening, we thought that was obvious so we didn't bother with the PM"

And people who send mails with times of (say) 13:00 GMT when what they actually mean is 13:00 local time in the UK (which is currently 12:00 GMT as we are in summer time).

Is it hot in here? Nurse!


AllenAdministrator
(KiX Supporter)
2010-08-16 04:34 PM
Re: Rename file with date using "move"

lol... get his meds now.. \:\)

Glenn BarnasAdministrator
(KiX Supporter)
2010-08-16 06:45 PM
Re: Rename file with date using "move"

What? Maintenance at 8 PM?? Can't nearly inconvenience enough people at that hour! Of course it's 08:00 (as in AM)! \:D

OK, Richard - how about those people who write 24:00 for midnight?? I actually found a script once that tried to trigger something at 24:00 instead of 23:59 or 00:00. "Time" as we refer to it is a measurment of its passing - at midnight of the current day, no (reasonably measurable) time has passed, so it is 00:00.

If you don't think time is important, consider the $$$$$$$$$ spend in 1999. \:\)

I had a moment this morning when I found that the time on my cell phone was off by 4 minutes.. It is supposed to sync with the carrier's time base - does this mean that time at one of the largest telecoms in the US has bad time sync?

Glenn

PS - stick to the good meds! \:\)


LonkeroAdministrator
(KiX Master Guru)
2010-08-16 06:51 PM
Re: Rename file with date using "move"

so, 12AM is midnight or noon?

NTDOCAdministrator
(KiX Master)
2010-08-17 02:22 AM
Re: Rename file with date using "move"

From Wikipedia 12 hour clock

The National Maritime Museum, Greenwich, states:

To avoid confusion, the correct designation for twelve o'clock is 12 noon or 12 midnight. Alternatively, the twenty-four-hour-clock system may be used. The abbreviation a.m. stands for ante-meridiem (before the Sun has crossed the line) and p.m. for post-meridiem (after the Sun has crossed the line). At 12 noon the Sun is at its highest point in the sky and directly over the meridian. It is therefore neither "ante-" nor "post-".[9]


Maybe this is also part of the reason. The US just doesn't want to change things. \:D

 Quote:
According to the CIA Factbook only Burma (Myanmar), Liberia, and the United States have yet to adopt the International System of Units as their official system of measurement.[


Richard H.Administrator
(KiX Supporter)
2010-08-17 09:58 AM
Re: Rename file with date using "move"

I once spotted a leap-second (belatedly - I'm not sad enough to sit in front of an atomic clock on New Year's Eve).

One of my Linux servers had been running for a couple of years and I happened to need to get onto the console, and there it was - notification that a leap second event had occurred and the time was 23:59:60

I am however sad enough to have taken a screen shot


LonkeroAdministrator
(KiX Master Guru)
2010-08-17 10:30 AM
Re: Rename file with date using "move"

well, that didn't remove any confusion at all.
to avoid confusion, everyone should abandon their wrist watches and learn the fact that there are 24 hours in a day.


Mart
(KiX Supporter)
2010-08-17 11:36 AM
Re: Rename file with date using "move"

If everyone used something like this then everything would be ok.

9 minutes past eight aka 8:09pm aka 20:09 on the watch below if I’m reading it correctly.


http://www.h-spot.net/watches_british.htm


LonkeroAdministrator
(KiX Master Guru)
2010-08-17 06:00 PM
Re: Rename file with date using "move"

lol.

and richard, that truly is odd. 23:59:60? \:o


Glenn BarnasAdministrator
(KiX Supporter)
2010-08-17 09:10 PM
Re: Rename file with date using "move"

Leap-seconds, eh? Well, that's cool in a geeky/nerdy kind of way..

Glenn


Richard H.Administrator
(KiX Supporter)
2010-08-18 08:44 AM
Re: Rename file with date using "move"

I found leap seconds briefly interesting, but of course on the Internerd you can always find someone who's fascination for a subject appears to be uncomfortably intense: http://www.leapsecond.com/

LonkeroAdministrator
(KiX Master Guru)
2010-08-18 07:41 PM
Re: Rename file with date using "move"

well... he seems to love HP.
thought he had time lab, not an hp storage.