Computing.Net > Forums > Programming > move the file with timestamp

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

move the file with timestamp

Reply to Message Icon

Name: sandhya
Date: August 24, 2008 at 10:59:19 Pacific
OS: xp
CPU/Ram: intel
Product: 2003
Comment:

Hi All,

I have a file by name sample.txt in FolderA..I have to copy this file to FolderB..,and i have to attached current system timestamp at the end of the file as follows sample.txt_200808242327

I am able to do this by individual commands at command prompt by copy and then using %date% and %time% variables..but i need to execute this from a .bat scripting..please help me how can i keep this in .Bat

Thanks,
Sandhya



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: August 25, 2008 at 06:33:04 Pacific
Reply:

I suppose you have worked ut how to get the needed parts of %DATE% and %TIME%, since they almost always contain chars not allowed in file names.

So if you've gotten these into vars, let's say %D% and %T%,::

copy sample.txt foldB\sample.txt%D%%T%


=====================================
If at first you don't succeed, you're about average.

M2


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: move the file with timestamp

moving files with a .bat www.computing.net/answers/programming/moving-files-with-a-bat/17109.html

Moving a file with an IF statement www.computing.net/answers/programming/moving-a-file-with-an-if-statement-/15017.html

Move files with date as parameter www.computing.net/answers/programming/move-files-with-date-as-parameter/16606.html