Actual file order in a directory
I have a TV that will do a slide show of photos from a USB device. I have a directory of my recent vacation photos with a sub-directory for each location we visited. The photos are properly in order by file name in Dolphin, Digikam and Gwenview. When I copy this directory structure to a USB device and show it on the TV the photos are not in order by file name. I have done research and found that this is a common problem in many devices like TVs and mp3 players. The displayed order and the physical file order in a directory in Linux are not the same. I did find a script called findalpha that stated it would correct this issue by creating a temporary directory and copying files one-by-one, in file name order, and then back to the original directory so that the actual order and file name order match. It doesn't work on my Kubuntu 11.10. The jpg files are still not in file name order on the USB device. I can't seem to locate any other solution. Has anyone else solved this problem?
|
You may need the file names to start with a number. For example, my DVD player expects that for pictures and mp3 files; such as
01_dog.jpg 02_cat.jpg The order given in a graphical file manager doesn't indicate any order in a directory. You can change how files are sorted, name, date, etc. Either by clicking on the column header, or by an option in the menu. If the order the TV sees reflects the order they were copied, you could copy the files to the USB pendrive in the shell. The wild card, e.g. cp *.jpg /media/usbdrive/, will result in the jpeg files being sorted and copied in that order. |
The idea of starting with a number did not work for me. However, the use of cp *.jpg /media/'stick name', appears to have worked. Now I need to develop a bash script that will do this recursively down the directory structure. Thanks for the tip.
|
I think the order is ls -f
|
Check out fatsort. It's probably already in your distro's repositories.
http://fatsort.sourceforge.net/ Also, if you would post the script you have, and whatever error messages/output you get, we may be able to figure out why it isn't working. Finally, note that names are generally sorted in ascii string order (or the order of the locale your system is set to), rather than numerically. So 10 will usually come before 2. If this is a problem you may want to zero-pad the numbers first. I've written a script that will automatically pad the numbers in filenames: Code:
|
I will try the fatsort idea. I assumed that fatsort was a windows thing when I saw it. I didn't read deep enough. The rename feature of Gwenview and Digikam does a good job of providing zero-filled, incremental, numbered names as well.
|
All times are GMT -5. The time now is 12:50 AM. |