Need a Batch File to Copy to a Custom Dest Folder


  1. Posts : 3
    Windows 7 Home Premium 64bit
       #1

    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 Computer


  2. Posts : 2
    Windows 7 Ultimate x64
       #2

    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 Computer


  3. Posts : 3
    Windows 7 Home Premium 64bit
    Thread Starter
       #3

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


  4. Posts : 2
    Windows 7 Ultimate x64
       #4

    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 Computer


  5. Posts : 3
    Windows 7 Home Premium 64bit
    Thread Starter
       #5

    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 Computer


 

  Related Discussions
Our Sites
Site Links
About 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 12:46.
Find Us