Batch file to copy files from C drive to USB

Page 2 of 2 FirstFirst 12

  1. tys
    Posts : 38
    Windows 7 Professional x64
    Thread Starter
       #11

    sorry, yes, automatically.
      My Computer

  2.    #12

    Code:
    @echo off
    :start
    XCOPY "<Source Path>" "<Destination Path>" /f 
    TIMEOUT /t 3600 /nobreak
    goto start
    The batch file should just copy and overwrite the old backup file with the new backup file without waiting for your response, I've left the /f switch so you know which files are being copied.
      My Computer


  3. tys
    Posts : 38
    Windows 7 Professional x64
    Thread Starter
       #13

    Thanks!

    Nearly there, but it still asks me for "(YES/NO/ALL)". Is there a way to get this script to work automatically without running a Scheduled Task?
      My Computer

  4.    #14

    Code:
    @echo off
    :start
    COPY "<Source Path>" "<Destination Path>"
    TIMEOUT /t 3600 /nobreak
    goto start
    I've just tried the batch file out now, and it doesn't prompt for anything, the only problem with COPY command is that it doesn't sub directories I believe.
      My Computer


  5. tys
    Posts : 38
    Windows 7 Professional x64
    Thread Starter
       #15

    Yup. lovely it works.


    Is there an add-on to this which enables files to be deleted, lets say older than a week?

    Thanks!
      My Computer

  6.    #16

    Code:
    @echo off
    DEL [[drive:][path]filename
    You wouldn't able to use the Timeout command for a week though, since the command is limited to 99999 seconds, which if I worked it out correctly, is 27 hours.

    You would have to create a different batch file, since I don't see how it could be added to the existing batch file without being added to the loop, which would mean your backups would be saved and then deleted every hour.

    With the above command, at least you wouldn't have to go searching for the backups.
      My Computer


 
Page 2 of 2 FirstFirst 12

  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 06:27.
Find Us