Copy Files from list

Posted on 2008-11-07
Last Modified: 2012-05-05
I need to copy 8777 files. These files are in list form.  


there are other files in these directories that i don't want to copy so i wrote a script with
xcopy and robocopy but neither worked as intended, xcopy works but prompts at each file copy and robocopy's syntax doesn't take a file name at the end of a directory.
Question by:OmnIT
    LVL 5

    Expert Comment

    Use the /y switch with xcopy to automatically supply a 'yes' answer to each prompt that xcopy interrupts your script with.
    LVL 1

    Author Comment

    It prompts File or Directory
    It is a File
    LVL 10

    Expert Comment

    xcopy will not prompt you if you use the /y switch

    full details on xcopy usage follow:

    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]

      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.
                   Specifies a list of files containing strings.  Each string
                   should be in a separate line in the files.  When any of the
                   strings match any part of the absolute path of the file to be
                   copied, that file will be excluded from being copied.  For
                   example, specifying a string like \obj\ or .obj will exclude
                   all files underneath the directory obj or all files with the
                   .obj extension respectively.
      /P           Prompts you before creating each destination file.
      /S           Copies directories and subdirectories except empty ones.
      /E           Copies directories and subdirectories, including empty ones.
                   Same as /S /E. May be used to modify /T.
      /V           Verifies each new file.
      /W           Prompts you to press a key before copying.
      /C           Continues copying even if errors occur.
      /I           If destination does not exist and copying more than one file,
                   assumes that destination must be a directory.
      /Q           Does not display file names while copying.
      /F           Displays full source and destination file names while copying.
      /L           Displays files that would be copied.
      /G           Allows the copying of encrypted files to destination that does
                   not support encryption.
      /H           Copies hidden and system files also.
      /R           Overwrites read-only files.
      /T           Creates directory structure, but does not copy files. Does not
                   include empty directories or subdirectories. /T /E includes
                   empty directories and subdirectories.
      /U           Copies only files that already exist in destination.
      /K           Copies attributes. Normal Xcopy will reset read-only attributes.
      /N           Copies using the generated short names.
      /O           Copies file ownership and ACL information.
      /X           Copies file audit settings (implies /O).
      /Y           Suppresses prompting to confirm you want to overwrite an
                   existing destination file.
      /-Y          Causes prompting to confirm you want to overwrite an
                   existing destination file.
      /Z           Copies networked files in restartable mode.

    The switch /Y may be preset in the COPYCMD environment variable.
    This may be overridden with /-Y on the command line.
    LVL 1

    Author Comment

    I already thought about uing the xcopy /i switch but that assumes its a directory
    LVL 5

    Expert Comment

    Xcopy should only give you the file/directory prompt if the destination specified ends with a backslash..  For example,

    xcopy c:\path\to\source\file.txt d:\path\to\destination\

    will give you the prompt of the 'destination' directory does not exist.  You should not get the prompt with no trailing backslash; just make sure that the path you are pointing to is there.
    LVL 21

    Accepted Solution

    Actually. Have your xcopy end with a *.* and it will assume it's a file and create all your destination folders if necessary. Add a /y if you want it to overwrite without prompting.

    xcopy c:\path\to\source\file.txt d:\path\to\destination\*.*


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
    Several part series to implement Internet Explorer 11 Enterprise Mode
    In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
    The viewer will learn how to download, install and use CrashPlan from on Windows 7. Open your browser and go to Click get started, it’s free then Click the Download CrashPlan button: Click save in Internet Explorer, the…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now