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 hardware mp3 player which seems to play the tracks in the order they were stored in the file system of the player. Hence, if i copy the files 01.mp3, 03.mp3 and 02.mp3 to the player in that order, they will be played in that very same order.

Which is annoying.

If copy a whole directory containing mp3-files to the player from a computer of mine running UNIX, the cp program will copy the files in whatever order the filenames are stored in that directory. My solution to this is to either copy the files of the directory one by one in the desired order, or by "sorting" the directory by creating new links to the files in the desired order, removing the old links and then renaming. This leaves me with a new set of links that are sorted.

I am aware of the fact that this "method of sorting" is highly unreliable as the only thing it relies on is the way the OS of my very computer manages directories. But, it does work.

Now, i have noticed that Windows seems to treat the files in directories in the same way as cp does. If i drag and drop a directory from a harddisk to my mp3 player, the files will be copied in the order they were created on the disk.

Of course, i am not able to port the program that sorts directories as Windows does not comply with POSIX (and a lot of other reasons), and even if it would be possible, i am not sure that i could exploit NTFS in the way i would like. Before i dig into this, i would like to ask if it is possible to fiddle with NTFS like i have been doing. I would also like to know if there are any better ways to accomplish my goal, which simply is to have the mp3 tracks played in the right order.

Good luck!

share|improve this question

migrated from stackoverflow.com Oct 28 '11 at 12:35

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

2  
Write a program that accepts a file list, sorts it using whatever criteria, and copies the sorted files to the player one by one? –  Jon Oct 27 '11 at 19:35
    
What happens if you resort the files in Windows Explorer before copying? Also, what version of Windows? Finally, this isn't really a question appropriate for this site. Please read the FAQ. –  LowTechGeek Oct 27 '11 at 19:37
1  
You could probably whip up a fairly simple perl script that would work on both windows and unix in the exact same way. Use readdir to read the list of files into an array, sort them the way you want them, then copy them to the device. –  Drew Burchett Oct 27 '11 at 19:38
1  
have you tried a filemanager that supports queues? like a ftp tool that uploads/downloads in a fixed order. a quick search came up with this one krusader.org/handbook/basic.html#queue (if you use kde) –  weberik Oct 27 '11 at 19:52
1  
There are a lot of things wrong with this question. Windows does have POSIX capabilities (and a ton of ported BSD and GNU tools to prove it); the behaviour is filesystem-format-specific; FAT exhibits the behaviour described; NTFS always stores directories sorted, since it uses tree structures on disc for directory contents; "fiddling with NTFS" will achieve nothing, especially if that is not the filesystem format used by the player; and the question doesn't even mention what filesystem format the player does use — vital for an answer. –  JdeBP Oct 28 '11 at 15:43

1 Answer 1

I had an mp3 player that had the same quirky behavior. Here's what I did:

  1. Create a temporary subdirectory.
  2. Move all the files into the subdirectory. This leaves the original directory empty (well, excepf for the subdirectory.)
  3. Move the files from the subdirectory back into the main directory, in the exact order I wanted the mp3 player to play them.
  4. Delete the temporary subdirectory.

You could write a script to automate this.

share|improve this answer
    
Using Windows explorer, select the last file then shift-click on the first file. This selects them in the proper order for the copy/move. –  Mark Ransom Oct 28 '11 at 5:08

Your Answer

 
discard

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