Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Want to Copy Files in a Defined Sequence

Status
Not open for further replies.

kc27

Technical User
Sep 10, 2008
171
US
It is possible to control the sequence with which Windows copies files?

I would like to be able to first read the file creation date or jpeg EXIF creation date, then copy files in sequence beginning with file that has the earliest creation date, ascending by file creation date to end with the file that has the latest creation date.

The files being copied are JPEGS, they are going from a Win XP hard drive to SD flash memory. The flash memory is then inserted into a digital photo frame, which then displays the jpegs in the order that they were written on the flash memory. The photo frame's minimal software does not offer any sorting of how the files are displayed. The default display order is the order in which the files were written to the flash memory.

Any ideas on this would be appreciated.
 
From within Explorer can you set the View/Sort order on the SD flash memory to Date Modified?

Can you temporarily copy the files that you wish to copy to the flash drive to a new folder. In that new folder set the view/sort order to Date Modified?
 
Thanks for the suggestion

For whatever reason, it's not the sort order in Windows Explorer that controls the order in which the photos appear on the digital photo frame. It displays them in the order that they were written to the flash memory. That's why I am looking for some way to control the order that the files are copied, or written, to the flash memory.
 
Did the second suggestion help with that problem?
 
If your SD flash memory card fitsinto your camera try this:

When I put my photos on an SD flash memory card for insertion into a digital photo frame (Kodak) I did it my inserting the empty flash memory card into my camera and then connecting my camera directly to the computer. The SD flash memory card showed up as a drive and I was able to copy and sort the photos as I wanted. I then put the SD flash memory card in the digital photo frame and the photos displayed in the order that I had sorted them.

Cheers.
 
This is a quickly composed (read at-work :) )cmd file that may be the basis of another that might do the trick:

Code:
dir /b /od>c:\junk.txt
FOR /F %%i IN (c:\junk.txt) DO copy %%i f:\

Start the cmd file within the directory containing the photos that you want to copy....f:\ would be the SD target drive. This cmd file needs work. You may want to massage the dir command to only include .jpg files, e.g. dir *.jpg /b /od>c:\junk.txt as a quick test showed that directories are copied too.
 
Freestone: Incidentally, you may wish to add a "delims=*" to your FOR and add quotes around the "%%i" in the copy, in case any of the file names contain spaces...

Code:
dir /b /od>c:\junk.txt
for /f "delims=*" %%i in (c:\junk.txt) do copy "%%i" f:\

...or even shorten it to just one line and eliminate the temporary text file...

Code:
for /f "delims=*" %%a in ('dir *.jpg /b /od') do @copy "%%a" f:\

(Note: Only one percent sign is used outside the context of a batch file.)
 
CaptainCommandLine: As I said, it needed work. Many thanks for the useful pointers. I had forgotten that a file isn't necessary when using the FOR /F flavor.

cmeagan656's suggestion, similar to linney's, seems the easiest.
 
Thanks everyone for the help, and Freestone and CaptainCommandLine for the script.

I gave CaptainCommandLine's pared down script a shot, and I get "/k was unexpected at this time." (k is the sd flash card)

The cmd file is in the directory that holds the photos. Any more ideas on this?



 
hmm, the Capn's code works fine here. Your cmd file should look like:

Code:
for /f "delims=*" %%a in ('dir *.jpg /b /od') do @copy "%%a" k:\
and from the command line:

Code:
for /f "delims=*" %a in ('dir *.jpg /b /od') do @copy "%a" k:\
Post the code you are using...
 
Here is what I did:

1. Opened notepad and entered
for /f "delims=*" %%a in ('dir *.jpg /b /od') do @copy "%%a" k:\

2. Saved above file as an "all files" format with name photo.cmd into the directory with the image files.

3. Opened a command prompt, navigated to the photo directory, and ran photo.cmd

4. Got this back:

C:\DOCUME~1\kcac\DESKTOP\PHOTOF~4>for /F "delims=*" %a in ('dir *.jpg /b /od') d
o @copy "%a" k:\
File Not Found
 
How are your photos named, including extension? It certainly looks as if the directory you ran the cmd file from does not contain any files with the .jpg extension.
 
I agree with Freestone. What do you get if you just type "dir *.jpg"? If nothing comes back, then there are no JPGs in that folder. The command, as it currently stands, will not copy JPGs from subfolders.
 
The script is fine - the user is broken. I retraced my steps and now it works.

My SD card reader for some reason would not read a newer, larger capacity card. Went out and got a new reader, hooked it up, and went back to an old directory out of habit, instead of the one with the jpegs, so the script was correct in reporting file not found.

Thanks to everyone for your expertise and patience in helping me get this going. I'll test this evening to see what order the frame displays the photos and report back.

Thanks again.
 
Freestone and CaptainCommandLine

Thanks so much for your help with this - it did the trick, the photos display in date order on the digital frame.
 
The script is saving me lots of time, so thanks much for the help. I do have one other request. Is there a way to modify the script so that it keys off the the "date picture taken" value? I've found that if I adjust a photo and then save it, the script then sorts the photo by today's date, rather than the date the photo was taken.

Again, any help on this would be appreciated.
 
The "date picture taken" is stored within the photo file (EXIF metadata) so in order to manipulate dates you need something to retrieve this data. If adding Date Picture Taken column header and sorting on that doesn't copy files in the correct sequence, then I found the following freebie, which uses JAVA:


Download the bin file (tar or zip) extract the files, and use its run.cmd.

I used filter: [Exif - Date/Time].jpg and got new copies of my JPG files with names YEAR MONTH DAY HR MIN SEC.jpg, with the fields filled in from the EXIF data. By substituting /on for the /od in the earlier posted scripts, you should be able to achieve the results you want.

There are many filter options. I only tried the one.
 
I should have said I used a Pattern of [Exif - Date/Time].jpg Filter is used for file selection (which I used *.jpg)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top