Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

i have a folder on windows that contains around 200,000 image files. i have created a text file containing all the image filenames i require to be copied, so i can extract them to a new folder (around 20,000). each image has a specific unique filename (examples would be xb0001.jpg, image 345766777.jpg etc..).

is there any program/process/batch that i can make use of to extract each of the images, as listed in my text file, from the original folder to a new folder?

i am abit green on command line, so any detailed help if batch process is a solution, would be of great help

share|improve this question

migrated from stackoverflow.com Jan 4 '13 at 1:23

This question came from our site for professional and enthusiast programmers.

@DanielA.White Well yes, but he could do it in c easily as well... –  Mark Robinson Jan 4 '13 at 0:26

2 Answers 2

From the start menu type Powershell and click on the Windows PowerShell icon that comes up (it should be on the top).

The run the following command:

Get-Content c:\filestocopy.txt | ForEach-Object {copy-item $_ c:\newlocation}

Make the following changes:

  1. c:\filestocopy.txt --> Make this the files you said you created
  2. c:\newlocation --> Make this the location you want you files to be copied to

Here is a breakdown of what this is doing:

Get-Content c:\filestocopy.txt  --> This reads the file you created to be used later
| (pipeline)                    --> This is called a pipe. It takes the object from the left and passes it to the command on the right.
ForEach-Object {  }             --> This runs the commands between the brakets {} on each object that is passed from the pipe
copy-item  $_ c:\newlocation    --> Just what it says, it copies $_ to c:\newlocation
$_                              --> This is a variable, it contains the current item from the pipe

Here are links to all the commands:

share|improve this answer

Windows includes the For/if combination, I prefer DOS commands since the majority of bugs have been worked out while newer and seemingly more powerful shells are still being exposed for usuability bugs.

md YourDriveLetter\%date% set newdestination = "YourDriveLetter\%date%"

for /F %%t in (YourGraphicsFileList) do copy /q "%NewDestination%"

200,000 images, well lets be honest, men to men here, the only kind of pictures that men collect 200,00o of are , yep, Car pictures !

And Windows or even a Mac have difficulty parsing out that many pics in any folder and trying to slim them down and group them by color, size and shape is a worthy idea but time consuming, but hey, there are few things guys like more than sitting alone and staring at Car picutres so you'll get to enjoy arraning every photo while taking breaks at regular inervals to reflect on all the cars you just looked at.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.