Dos a one-liner command exist to copy a file to several directories, preferrably as part of a windows shell script? No external tools (such as robocopy) must be used.
The copy command allows use of different source files but one destination directory only.
Is there any possibility (or maybe a command line quirk) to overcome this restriction?
Or maybe a better command I should use?
Environment: WinXP, Win7 or Win10.
Scenario:
A file list (.txt file) that contains hundreds of file names and their destination folders.
Something like this (snip):
"*genotypisierung*.sav" "Folder1"
"*_strahlentherap*.sav" "Folder2"
"*tumorkonf*.sav" "Folder3\Subfolder1"
"*tumorkonf*.sav" "Folder3\Subfolder2"
...
This was my first approach to walk through this list (destination folders has been created before via MD command):
FOR /F "tokens=1-2 delims=[space] [tab][space]" %%a in ('TYPE "FileList.txt"') DO ( COPY /N /Y %%a %%b >NUL 2>&1 || ECHO. Error copying %%~a to %%b && SET _Err=1)
Have a look at example entries 3 and 4: It's quite annoying for me to repeat the folder names for one specific file if it has to be copied to different places.
Any suggestions to improve this approach?
Much thanks in advance for any response
Zharif