Go Back   Computer Forums > General Computing > Programming
Click Here to Login
Join Computer forums Today

Thread Tools Search this Thread Display Modes
Old 04-27-2012, 04:26 AM   #1
Baseband Member
Teris's Avatar
Join Date: Oct 2011
Posts: 46
Default Copy Script

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.

Primary - Gigabyte GA-990-FXA UD7, Phenom x6 1100T, 16gb Corsair Vengance, WD Caviar Black 750gb, CM 850w, XFX 6850 XXX x2 CrossfireX, CM HAF-X
Secondary - Asus P5K, Intel Q6600, 4gb OCZ 800mhz, Samsung 500gb, Corsair 600w CX600, Nvidia 8800gts, X-Clio A1
NAS: Seagate BlackAmor 400 2x 1.5tb Barracuda RAID1
Teris is offline   Reply With Quote
Old 04-30-2012, 05:48 AM   #2
Site Team
berry120's Avatar
Join Date: Jul 2009
Location: England, UK
Posts: 3,434
Default Re: Copy Script

Just create a batch file with the following:

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...!

Save the whales, feed the hungry, free the mallocs.
berry120 is offline   Reply With Quote
Old 04-30-2012, 06:10 AM   #3
Fully Optimized
strollin's Avatar
Join Date: Mar 2011
Location: USA
Posts: 2,329
Default Re: Copy Script

This should work:

copy C:\misc\log.txt C:\copied\%date%_%username%_log.txt
Although the date string may not be exactly what you want.
strollin is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

All times are GMT -5. The time now is 02:02 PM.

Powered by vBulletin® Version 3.8.8 Beta 4
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Search Engine Friendly URLs by vBSEO 3.6.0