Search and copy files from particular folder

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
zagix
Posts: 68
Joined: 16 Oct 2013 23:19

Search and copy files from particular folder

#1 Post by zagix » 11 Jun 2016 08:53

Hi,

I need to copy .pdf's files from particular folder to destination folder.
The folder Root is at C:\Backup and in them multiple sub-folders are there.

C:\Backup --root folder
Database--sub-folder
01012016--sub-folder,sub-folder,sub-folder,sub-folder,IME
02012016--sub-folder,sub-folder,sub-folder,sub-folder,sub-folder,sub-folder,IME
03012016--sub-folder,sub-folder,sub-folder,sub-folder,sub-folder,sub-folder,sub-folder,IME
04012016--sub-folder,sub-folder,sub-folder,sub-folder,sub-folder,sub-folder,sub-folder,sub-folder,sub-folder,IME
05012016--sub-folder,IME

Now selecting only IME folder copy all the .pdf files inside them to C:\IMEPDF

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Search and copy files from particular folder

#2 Post by aGerman » 11 Jun 2016 09:14

Give that a shot:

Code: Select all

set "root=C:\Backup"
set "dest=C:\IMEPDF"

for /f "delims=" %%i in ('dir /ad /b /s "%root%\IME"') do copy "%%i\*.pdf" "%dest%\"

Regards
aGerman

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Search and copy files from particular folder

#3 Post by foxidrive » 14 Jun 2016 22:59

zagix wrote:I need to copy .pdf's files from particular folder to destination folder.


zagix, was aGerman's help useful for you?

zagix
Posts: 68
Joined: 16 Oct 2013 23:19

Re: Search and copy files from particular folder

#4 Post by zagix » 15 Jun 2016 02:51

Hi,

Sorry for delay in reply.

Thanks works perfectly.

Post Reply