Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Batch file that copies text files according to date  (Read 6708 times)

0 Members and 1 Guest are viewing this topic.

3ddy

    Topic Starter


    Rookie

    Batch file that copies text files according to date
    « on: February 12, 2008, 06:28:33 AM »
    Does any one know have a batch file that can search across a network for files that were created today and then copy them to another location across the network?
    « Last Edit: February 19, 2008, 08:22:54 AM by 3ddy »

    SOAP



      Beginner

      Try using this...
      « Reply #1 on: February 12, 2008, 05:03:24 PM »
      I have had to do that, but try using this program, Auto mate 6. Download a 30 day trial from here:

      http://www.networkautomation.com/downloads/am6download.cfm

      Tell me if it helps :)!

      3ddy

        Topic Starter


        Rookie

        Re: Batch file that copies test files according to date
        « Reply #2 on: February 13, 2008, 01:02:36 AM »
        Will try downloading the tool

        This is the code that some one suggested, but i cant get it to work for my setup

        @ECHO OFF
                                                     
        IF "%1" == "" GOTO COPY-TODAY                   
        IF NOT "%1" == "" GOTO COPY-DATE             
                                                         

        :COPY-TODAY                                   
        ECHO. | DATE | FIND /I "Current" > c:\BATCH\CUR-DATE.BAT
        ECHO @SET CUR-DATE=%%4 > C:\BATCH\CURRENT.BAT
        CALL C:\BATCH\CUR-DATE.BAT

        XCOPY *.* C:\BATCH /D:%CUR-DATE% <       
                                                         
                                                         
        GOTO END

        :COPY-DATE                                     
        XCOPY *.* C:\UPLOAD /D:%1 /-Y                     
                                                         
        :END
        ECHO.                                         
        CALL C:\BATCH\DR.BAT C:\UPLOAD                 
                                                       
                                                       

        SET CUR-DATE=                                 
                                                       

        DEL c:\batch\CUR-DATE.BAT                                 
        DEL c:\batch\CURRENT.BAT     




        have been trying to get it to work in with this next bit of code

        @echo off
        echo copying files from 192.168.0.141
        pause
        xcopy /d \\192.168.0.141\d$\Hypercommain\*.txt \\192.168.0.108\d$\Hypercom\

        @echo off
        echo renaming file
        pause
        for /f "tokens=2 delims= " %%A in ('date/T') do (
        set date=%%A)
        for /f "tokens=1-3 delims=/" %%A in ('echo %date%') do (
        set m=%%A
        set d=%%B)
        ren "\\192.168.0.108\d$\hypercom\*.txt" zsw%m%%d%

        @echo off
        echo backing up to ZEDI Backup
        pause
        xcopy /e \\192.168.0.108\d$\Hypercom \\192.168.0.141\d$\testing



        3ddy

          Topic Starter


          Rookie

          Re: Batch file that copies test files according to date
          « Reply #3 on: February 18, 2008, 05:16:34 AM »
          automate 6 didn't work i wanted it to
          The whole point of this batch file is to avoid user error
          Have designed this batch file so that the user simply clicks on it and it does all the work and thinking involved. Without me having to worry that the user has messed around with the wrong files or settings
          Any help is greatly appreciated

          SOAP



            Beginner

            Re: Batch file that copies test files according to date
            « Reply #4 on: February 18, 2008, 04:16:09 PM »
            Well im stumped. I have never really had to do something like that.

            3ddy

              Topic Starter


              Rookie

              Re: Batch file that copies text files according to date
              « Reply #5 on: February 21, 2008, 12:16:10 AM »
              Have decided to use a combo of the program you suggested and a bit of my batch file
              Automate will find the files i need, copy them to the location i want them to be, and the my batch file will kick in and rename my files as i want them
              Thanks for all the help