Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 507
  • Last Modified:

Copy Files from list

I need to copy 8777 files. These files are in list form.  

Example
D:\Data\V1\10\1004221.TIF
D:\Data\V1\100\1409685.TIF  

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.
0
OmnIT
Asked:
OmnIT
1 Solution
 
Ghoti_AZCommented:
Use the /y switch with xcopy to automatically supply a 'yes' answer to each prompt that xcopy interrupts your script with.
0
 
OmnITAuthor Commented:
It prompts File or Directory
It is a File
0
 
TOPIOCommented:
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]
                           [/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.
  /EXCLUDE:file1[+file2][+file3]...
               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.
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
OmnITAuthor Commented:
I already thought about uing the xcopy /i switch but that assumes its a directory
0
 
Ghoti_AZCommented:
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.
0
 
AmazingTechCommented:
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\*.*

0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now