Copy files in different subdirectories to another directory using a file list

107 Views Asked by At

so I have a list of about 26,000 files that I need Copied/moved to a different directory on a server. The different files in the list all have different sub-directory locations and names in the main source folder and the paths are specified in the filelist document.

The source filepath is on a network drive so (V:\RandomFolder\RandomSubdirectory)

The destination filepath would be on the local machine so (C:\RandomDestination)

I looked into seeing of robocopy could pull from the file list and move that way but I couldn't seem to find a way to make that work. Anyone got any ideas? I'd really appreciate any help.

1

There are 1 best solutions below

0
On

Okay I figured it out, if anyone runs into this conundrum just follow like what is below( and edit to your liking and save it as a .bat

`@ECHO ON

SET FileList=C:\listoffilestomove.txt
SET Source=\\TopLevelOfNetworkOrFolderSourceDirectory\
SET Destination=C:\yourdestination

FOR /F "USEBACKQ TOKENS=*" %%F IN ("%FileList%") DO XCOPY /F /Y "%Source%\%%~F" "%Destination%\"

GOTO :EOF`