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
Todash

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
jwinney

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
Todash

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
jwinney

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
Todash

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
Thread Forum
Windows7 Batch File Copy Possible?
Fellow Forum Members, I have two external hard drives I'm calling Hard Drive A and Hard Drive B. Hard Drive A & B are mounted to external USB cradles. Both USB cradles are connected to the same PC containing Hard Drive C. My objective is to transfer all data files, folders, sub folders from both...
Performance & Maintenance
How to copy a file from 1 pc to another pc in network using batch file
Help me make a batch file that copies a file from one computer to another computer in a network... PC1 = Source PC2 = Destination I want to copy a file from PC1's Drive E: to PC2's Drive E:
General Discussion
search multiple files, copy+paste to new folder (batch file software?)
I am a complete newbie when it comes to batch files and batch file software, so apologies in advance. I've done some research on Google etc but I seem to just be getting more and more confused trying to use various different scripts and programs and reading different info on various websites. ...
General Discussion
Custom batch file that copies font files to another folder?
I just downloaded all of the Google Web Fonts and they were each downloaded into their respected folders, so instead of clicking on folder after folder and right clicking after right clicking and finally installing each and every font; How can I create a command prompt (batch) file so the prompt...
General Discussion
Batch File that grabs file names from folder to insert into batch file
Ok I'm totally at a loss on how to word this so I'm just going to write it out the best that I can... :confused: First I have a batch file that I'm writing that will convert mp4 files to mp3 files (I have a lot) for a buddies band using ffmpeg. Here's the code that I'm using: ffmpeg -i...
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 19:39.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App