Page 1 of 2 12>
Topic Options
#199501 - 2010-08-12 03:17 PM Rename file with date using "move"
Nicklas Offline
Fresh Scripter

Registered: 2010-06-07
Posts: 6
Loc: Sweden
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

Top
#199502 - 2010-08-12 03:43 PM Re: Rename file with date using "move" [Re: Nicklas]
eriqjaffe Offline
Hey THIS is FUN

Registered: 2004-06-24
Posts: 214
Loc: Arlington Heights, IL USA
Try it like this:

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

Top
#199504 - 2010-08-12 04:06 PM Re: Rename file with date using "move" [Re: eriqjaffe]
Nicklas Offline
Fresh Scripter

Registered: 2010-06-07
Posts: 6
Loc: Sweden
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

Top
#199505 - 2010-08-12 04:16 PM Re: Rename file with date using "move" [Re: Nicklas]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
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"

Top
#199507 - 2010-08-12 04:30 PM Re: Rename file with date using "move" [Re: Allen]
Nicklas Offline
Fresh Scripter

Registered: 2010-06-07
Posts: 6
Loc: Sweden
It worked!

thx alot!

Top
#199524 - 2010-08-13 12:22 PM Re: Rename file with date using "move" [Re: Nicklas]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
@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.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#199528 - 2010-08-13 03:11 PM Re: Rename file with date using "move" [Re: Mart]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
Actually not. @TIME and @DATE are based on your regional setttings. If they contains slash separators then @TIME and @DATE will use those.
Top
#199530 - 2010-08-13 05:08 PM Re: Rename file with date using "move" [Re: Arend_]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Yep. Sorry missed that one.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#199531 - 2010-08-13 05:09 PM Re: Rename file with date using "move" [Re: Arend_]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
 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.

Top
#199556 - 2010-08-14 03:44 PM Re: Rename file with date using "move" [Re: Richard H.]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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.
_________________________
!

download KiXnet

Top
#199559 - 2010-08-14 06:15 PM Re: Rename file with date using "move" [Re: Lonkero]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
"Screwed up way" as it is in the manual or ...?
Top
#199560 - 2010-08-14 06:20 PM Re: Rename file with date using "move" [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
screwed up = not the way I like it ;\)
_________________________
!

download KiXnet

Top
#199561 - 2010-08-14 06:24 PM Re: Rename file with date using "move" [Re: Lonkero]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4549
Loc: USA
lol... okay... so do you not like yyyy/mm/dd?

Edited by Allen (2010-08-14 06:25 PM)

Top
#199567 - 2010-08-14 10:58 PM Re: Rename file with date using "move" [Re: Allen]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
not as much as dd.mm.yyyy

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

download KiXnet

Top
#199568 - 2010-08-14 10:59 PM Re: Rename file with date using "move" [Re: Lonkero]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
lol. I got CENSORED!
_________________________
!

download KiXnet

Top
#199569 - 2010-08-14 11:40 PM Re: Rename file with date using "move" [Re: Lonkero]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
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

Top
#199570 - 2010-08-15 12:25 AM Re: Rename file with date using "move" [Re: NTDOC]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
yes, it sorts nicely.
but kixtart uses yyyy/mm/dd
you can't use such formatting with files in wintosh machines.
_________________________
!

download KiXnet

Top
#199596 - 2010-08-16 02:54 PM Re: Rename file with date using "move" [Re: Lonkero]
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
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.

Top
#199597 - 2010-08-16 03:00 PM Re: Rename file with date using "move" [Re: Richard H.]
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
 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
_________________________



Top
#199602 - 2010-08-16 03:53 PM Re: Rename file with date using "move" [Re: Jochen]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
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
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 2 12>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 369 anonymous users online.
Newest Members
rrosell, PatrickPinto, Raoul, Timothy, Jojo67
17877 Registered Users

Generated in 0.08 seconds in which 0.028 seconds were spent on a total of 15 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org