Announcement

Collapse
No announcement yet.

DOS Program to copy recently updated files

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DOS Program to copy recently updated files

    Hi to all,
    I have a simple DOS program that copies files from one folder to
    another. Here it is:

    echo on
    cd \esri\esridata\usa\
    copy states.sbn c:\temp
    copy states.sbx c:\temp
    copy states.shp c:\temp
    copy states.shx c:\temp
    copy states.dbf c:\temp
    copy states.prj c:\temp
    exit

    I would like to modify this so that files that were most recently
    updated are the ones that get copied. Is this possible? If so
    can someone give me an example?

    Cheers,
    Michael

    ------------------

  • #2
    you can use interrupt &h21 function &h57 subfunction 0 to get
    the date and time of a file.
    http://www.powerbasic.com/support/pb...read.php?t=716
    ------------------


    [this message has been edited by mel bishop (edited february 02, 2004).]
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

    Comment


    • #3
      Originally posted by Michael Montemayor:
      I would like to modify this so that files that were most recently
      updated are the ones that get copied. Is this possible? If so
      can someone give me an example?
      Code:
      XCOPY /?
      
      XCOPY source [destination] [/A | /M] [/D[:date]] [/P] [/S [/E]] [/V] [/W]
                                 [/C] [/I] [/Q] [/F] [/L] [/G] [/H] [/R] [/T] [/U]
                                 [/K] [/N] [/O] [/X] [/Y] [/-Y] [/Z]
                                 [/EXCLUDE:file1[+file2][+file3]...]
      
        source       Specifies the file(s) to copy.
        destination  Specifies the location and/or name of new files.
        /A           Copies only files with the archive attribute set,
                     doesn't change the attribute.
        /M           Copies only files with the archive attribute set,
                     turns off the archive attribute.
        /D:m-d-y     Copies files changed on or after the specified date.
                     If no date is given, copies only those files whose
                     source time is newer than the destination time.
      [...]
      Maybe XCOPY with the /D swtich will do the job (if you simple need to do it from a batch file)?

      Bye!



      ------------------
      Try TrID file identifier! Over 940 filetypes and counting...
      -- The universe tends toward maximum irony. Don't push it.

      File Extension Seeker - Metasearch engine for file extensions / file types
      Online TrID file identifier | TrIDLib - Identify thousands of file formats

      Comment


      • #4
        Marco,
        Is my syntax incorrect here? I simply want to copy any files
        modifired on 12-15-2003 from c:\temp\temp1 to c:\temp\temp2. I
        am trying to run this as a batch file. Am I doing something wrong?
        Thanks for the help.

        Michael

        xcopy C:\temp\temp1 C:\temp\temp2 /D 12-15-2003

        ------------------

        Comment


        • #5
          Originally posted by Michael Montemayor:
          xcopy C:\temp\temp1 C:\temp\temp2 /D 12-15-2003
          I think there's supposed to be a colon between /D and 12
          i.e.,
          xcopy C:\temp\temp1 C:\temp\temp2 /D:12-15-2003

          In any case, a space there is quesionable.

          BTW: In my first reply, you specifiec a DOS program and I just
          assumed an EXE file and you shelled.


          ------------------
          There are no atheists in a fox hole or the morning of a math test.
          If my flag offends you, I'll help you pack.

          Comment

          Working...
          X