Sign in to follow this  
Followers 0
redfive19

Copy files from many folders to one folder

4 posts in this topic

Hi guys,

I know that Robocopy and Xcopy can recursively search for file masks (*.jpg) and copy them to another folder but they keep the directory structure. Is there any script that anyone knows of that does this with just copying the files to one folder sans folder structure? Example: All .jpg's from C:\folderswithpics\folder1 to c:\pictures Thanks!!!

-redfive

Share this post


Link to post
Share on other sites



Hi guys,

I know that Robocopy and Xcopy can recursively search for file masks (*.jpg) and copy them to another folder but they keep the directory structure. Is there any script that anyone knows of that does this with just copying the files to one folder sans folder structure? Example: All .jpg's from C:\folderswithpics\folder1 to c:\pictures Thanks!!!

-redfive

You can do this in AutoIt with _FileListToArray() or FileFindFirstFile()/FileFindNextFile(), and FileCopy().
1 person likes this

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt

Share this post


Link to post
Share on other sites

Hi!

You can do a little batch, like this:

FOR /F "tokens=*" %%i in ('dir C:\sourceroot /AD /s /b') DO XCOPY "%%i\*.jpg" C:\destdoss /Y

Where:

source-root-folder is C:\sourceroot

destination folder is C:\destdoss

pattern files is *.jpg

If you use the command directly (without Batch), replace all %% by %

.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0