Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Need a Batch File to Copy to a Custom Dest Folder


01 Jun 2012   #1

Windows 7 Home Premium 64bit
 
 
Need a Batch File to Copy to a Custom Dest Folder

I need help with a batch file to copy the contents of my source dir to the destination dir that is to be created with that days date using xcopy or robocopy. Any help is appreciated!


My System SpecsSystem Spec
.

01 Jun 2012   #2

Windows 7 Ultimate x64
 
 

This should get you started...

for /F "tokens=1-4 delims=/- " %%A in ('date/T') do set DATE=%%A-%%B-%%C
md c:\tmp\%DATE%
xcopy c:\output c:\tmp\%DATE% /s
My System SpecsSystem Spec
01 Jun 2012   #3

Windows 7 Home Premium 64bit
 
 

Brilliant! Works perfectly. Was wondering though if I can change the date format to something like 2012.06.06?
My System SpecsSystem Spec
.


01 Jun 2012   #4

Windows 7 Ultimate x64
 
 

Yes, the first line splits up the current date into its parts and sets the variable %DATE% to these parts.
So %%C.%%B.%%A will give the year first with dots in between.
My System SpecsSystem Spec
01 Jun 2012   #5

Windows 7 Home Premium 64bit
 
 

Thanks for the this. The format I went with is DATE=%%D.%%B.%%C.
Thanks again. You have saved me a lot of time. I can now schedule it to run automatically.
My System SpecsSystem Spec
Reply

 Need a Batch File to Copy to a Custom Dest Folder




Thread Tools



Similar help and support threads for2: Need a Batch File to Copy to a Custom Dest Folder
Thread Forum
Windows7 Batch File Copy Possible? Performance & Maintenance
How to copy a file from 1 pc to another pc in network using batch file General Discussion
Batch file copy made easy Performance & Maintenance
search multiple files, copy+paste to new folder (batch file software?) General Discussion
Custom batch file that copies font files to another folder? General Discussion
Solved Batch File that grabs file names from folder to insert into batch file General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 11:59 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33