Copy Script

Teris

Baseband Member
Messages
46
I'm trying to make a copy script that copies and renames a text file from the users machine on logoff.

Say the text file is here: C:\misc\log.txt
And I want it to be copied with this rename process: C:\copied\2012-04-27_USERNAME_log.txt



Does anyone know the code to easily do this?

Cheers all.
 
Just create a batch file with the following:

Code:
xcopy C:\misc\log.txt C:\copied\2012-04-27_USERNAME_log.txt

And as for setting that to execute at logoff, see the second post here.

EDIT: Doh. Didn't look at the date / username properly in the requirements, see the below post. That's what happens when I'm in a hurry...!
 
This should work:

Code:
copy C:\misc\log.txt C:\copied\%date%_%username%_log.txt

Although the date string may not be exactly what you want.
 
Back
Top Bottom