Computer Hope

Other => Other => Topic started by: Amram Chayim Eirinberg on December 26, 2011, 07:29:04 PM

Title: Copy multiple files
Post by: Amram Chayim Eirinberg on December 26, 2011, 07:29:04 PM
Hi

I have a list of many filenames , I need the code in DOS to copy them all to another folder

Any help will be greatly appreciated !

Howard
Title: Re: Copy multiple files
Post by: joy division on December 27, 2011, 01:19:09 PM
Change to the directory first where the files are that you want to copy. 

Then:

copy *.* X:\destination directory

Replace X with whatever drive the destination directory is on.

If you only want to copy files with certain file extensions then use: *.doc
for example.

There are different ways of doing it depending on your needs.

I'd recommend googling how to use the copy command to suit your needs.
Title: Re: Copy multiple files
Post by: Salmon Trout on December 27, 2011, 02:42:11 PM
I have a list of many filenames , I need the code in DOS to copy them all to another folder

I am assuming the list of filenames contains the complete drive letter and path of each file like this example:

Code: [Select]
S:\App-install\wizapp15\license.txt
S:\App-install\wizapp15\versions.txt
S:\App-install\wselect\out$$.txt
S:\App-install\wselect\screen.txt
S:\App-install\wselect\test$$.txt
S:\App-install\wselect\Wselect.txt
S:\App-install\X-Setup-9.2.100\readme-EN.txt
S:\App-install\X-Setup-9.2.100\ReadMe.txt
S:\Backup\basic\FreeBASIC\changelog.txt
S:\Backup\basic\FreeBASIC\docs\GoRC.txt
S:\Backup\basic\FreeBASIC\docs\gpl.txt
D:\eula.1028.txt
D:\eula.1031.txt
D:\eula.1033.txt
D:\eula.1036.txt
D:\eula.1040.txt
D:\eula.1041.txt
D:\eula.1042.txt
D:\eula.2052.txt
D:\eula.3082.txt
D:\fraglist.txt
D:\Alacarta\TVE-Alacarta-Hoy\Bin\Progtitle.txt
D:\Alacarta\TVE-Alacarta-Hoy\Bin\thisfilename.txt
D:\Alacarta\TVE-Alacarta-Hoy\Bin\Ngrep-byline-dump\dump1.txt
D:\Alacarta\TVE-Alacarta-Hoy\Bin\Ngrep-byline-dump\dump2.txt
D:\OS-Install\cd110511\README.TXT
D:\Virtual Machines\Suse114-1\Readme.txt

You can use a batch script to read the file line-by-line and copy each file to the chosen destination directory.

Assumptions:

The file containing the list is C:\test\File List.txt
The files are copied to D:\Destination\Folder

Try this

Code: [Select]
@echo off
set listfile=C:\test\File List.txt
set CopyToFolder=D:\Destination\Folder
for /f "delims=" %%A in ( ' type "%listfile%" ' ) do copy "%%A" "%CopyToFolder%"