Results 1 to 6 of 6

Thread: HELP: Dos Programming to Copy file

  1. #1
    Lively Member
    Join Date
    Feb 07
    Posts
    71

    HELP: Dos Programming to Copy file

    Hi all
    I am not sure where to post this question so I thought I just put it in general discussion, I hope someone can help me out

    I need to create a batch file where it will copy a folder from C: drive to D: Drive

    Now I read a couple copy command article and could not find one to set the parameter to skip all .. like - if the files already exist skip it

    so the goal here I want to copy all files in C drive to D drive, and if the file already exist, don't overwrite it and instead skip to the next file.


    Here is what I have
    Code:
    copy c:\test1\*.* d:\test1\*.* /y
    /y = do not prompt for overwrite

    ideally I want to say no to all / skip all , but only cope files that does not exist yet
    is there a parameter for that?

    Thank you

  2. #2
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: HELP: Dos Programming to Copy file

    General PC is a good place for this (moved).

  3. #3
    ASP.NET Moderator mendhak's Avatar
    Join Date
    Feb 02
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,174

    Re: HELP: Dos Programming to Copy file

    What you can try (try... try! Experiment first) is to use the DOS 'attrib' command to set the existing files to be read-only. Then copy the files over with the /y switch - it shouldn't overwrite the existing read-only files.

  4. #4
    Lively Member
    Join Date
    Feb 07
    Posts
    71

    Re: HELP: Dos Programming to Copy file

    Hi all
    I update it to use xcopy now. now it has param /y and /e to copy all the directory and subdirectory

    Code:
    xcopy C:\test1\*.* D:\test2\*.* /y /e
    I plan to put this batch file into task scheduler, so I will have a daily copy of my files..

    thanks in advance
    Last edited by ndondo; Apr 11th, 2008 at 04:41 PM.

  5. #5
    Lively Member
    Join Date
    Feb 07
    Posts
    71

    Re: HELP: Dos Programming to Copy file

    Or maybe another idea, I can just delete the file that has already been copied. so then I will only copy the latest file ..

    the file name is incremental by today's date

    eg:
    test 04-11-2008.zip
    test 04-12-2008.zip
    test 04-13-2008.zip

    so if I delete the file after copying I will not overwrite anything right?

    thank for moving the post .

  6. #6
    Cyberman Lord Orwell's Avatar
    Join Date
    Feb 01
    Location
    Elberfeld, IN
    Posts
    7,419

    Re: HELP: Dos Programming to Copy file

    there is an xcopy parameter for this. for a list of xcopy commands, type this at the command prompt:
    Code:
    xcopy /?
    The correct methods are one of two ways: either copy only files with the archive bit set, or copy files newer than a certain date. xcopy can do either.
    John Lord, Evansville Indiana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •