I want to copy all images of any file extension like .jpg, .png, .gif, etc. from all folders and subfolders in my PC hard drive (which has two partitions) to a single folder.
The total number of images I have is 250,000.
16 Answers
The easiest way is probably to make a batch file, which searches recursively for a specific file type and copy all instances of it to a folder of your choice. This script should do the job for one partition at a time:
for /R "C:\" %%G in (*.png *.jpg *.jpeg *.gif) do copy "%%G" "E:\allPictures\"
pauseBe aware, that I would strongly advise you to add an external hard drive and point the output to a folder on it. You don't want the batch script copying from it's own output folder.
E:\allPictures\ is the output, which is what you need to change.
Save it as "something.bat" and execute.
Explanation
The script starts searching from the directory you give it. In my example I've chosen C:\ per your request.
The /R tells it to start looking thru every single folder below the chosen folder aka recursively, for the given file types: (*.png *.jpg *.jpeg *.gif)
%%G is a placeholder/container for the full path to a file. So if the file it just found fits the requested file type, it will supply it to the copy command.
At the end you have the path to your output folder. E:\allPictures\
The pause at the end, is so you know when it's done.
Hope that answers your question.
Good luck!
5In Windows Explorer, search for:
*.png OR *.gif OR *.jpg OR *.jpeg*Select all files, and copy them to wherever you want
2You can use something simple like xcopy
xcopy c:\*.jpg e:\ /sThis will copy all the JPG files in C: drive to the root of E: and create the folders as XCOPY finds them in on the C: drive.
You just have to do this repeatedly for the different files types such as gif, png, tiff, or whatever other file format you want to consolidate.
2I am not sure but I think there are many software out there who shows all the pictures from your harddrive in a single Interface. When it shows on the single interface, it will be easy to copy all those images to one folder. I am not sure but I think flickr was one of them.
Or you could also open the window explorer and search for *.jpg OR *.png and other format of pictures that you think you have and you can manually copy to one folder. But it is a lot of work to do.
Do it in PowerShell.
$sourcePath = 'C:\StartFolder'
$destPath = 'C:\DestFolder'
Get-ChildItem $sourcePath -Recurse -Include '*.foo', '*.bar' | Foreach-Object ` { $destDir = Split-Path ($_.FullName -Replace [regex]::Escape($sourcePath), $destPath) if (!(Test-Path $destDir)) { New-Item -ItemType directory $destDir | Out-Null } Copy-Item $_ -Destination $destDir } 1 Open windows explorer.
In the upper right search box enter this:
kind:=picture
Press enter and it will search for all pictures.
1