0

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.

  • do you want to preserve the folder structure? – Sun Sep 22 '14 at 20:23
5

In Windows Explorer, search for:

*.png OR *.gif OR *.jpg OR *.jpeg*

Select all files, and copy them to wherever you want

  • Dear there is alot of images around 3 lakhs, so you idea doen't work for me – KAPIL GUPTA Sep 20 '14 at 17:14
  • in Windows Explorer search for kind:image will you all image files regardless of extension – phuclv Aug 15 '18 at 15:21
4

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\"
pause

Be 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!

  • I Dont know about the batch file so, pls Explain me all the things in this ans given by you "for /R C:\ %%G in (*.png *.jpg *.jpeg *.gif) do copy "%%G" E:\allPictures\ pause" – KAPIL GUPTA Sep 20 '14 at 17:21
  • I Used this Batch file but there is a issue regarding copy of Images, i am saying that becoz i manually check (search for *.jpg OR *.png) the No of Images in my drive & by batch file i found that mannually no of Images is (3164) & Batch file copied (2855) – KAPIL GUPTA Sep 22 '14 at 6:46
  • I'm not sure I understand your last comment. – Q11x Sep 22 '14 at 20:03
  • I've included an explanation of the code in the answer. Hope it makes sense. – Q11x Sep 22 '14 at 20:22
  • No of Images in my drive & by batch file i found that mannually no of Images is (3164) & Batch file copied (2855) If you searched in both your main and secondary partition (C:\ & D:) at the same time, that explains it. The script only checks one drive. As I stated in my answer, you'll have to run it for each drive separetly. – Q11x Sep 22 '14 at 20:26
1

You can use something simple like xcopy

 xcopy c:\*.jpg e:\ /s

This 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.

  • I tried it but the files copied to their Destination is not in the root folder the copied from source with Directories of Files. – KAPIL GUPTA Sep 23 '14 at 6:12
  • 1
    I asked if you want to preserve the folder structure or not. If you do not, then it complicates things because if you have same file name in different folders, then there is problem of renaming file name or over writing file names. – Sun Sep 23 '14 at 6:16
0

I 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.

-1

Open windows explorer.
In the upper right search box enter this:

kind:=picture

Press enter and it will search for all pictures.

  • Please read the question again carefully. Your answer does not answer the original question. – DavidPostill Feb 18 '17 at 23:07
-1

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
    }
  • Can you explain how to use this code to solve the OP problem? As its current form, non-power user cannot tell what this script do and how to customize it to solve their problem. – Vylix Sep 5 '17 at 3:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.