3

I want to know how can I sort my files in Windows Explorer using the last two digits in the file name. I have the following files in my folder:

f00001.jpg
f00002.jpg
f00003.jpg
b00001.jpg
b00002.jpg
b00003.jpg

But I want to sort by the next way:

f00001.jpg
b00001.jpg
f00002.jpg
b00002.jpg
f00003.jpg
b00003.jpg

Is there a way to achieve this? I tried many "Group By" and "Sort By" options with no result. I'm using Windows 7 Professional SP1 32-bit.

4
  • 1
    No, this doesn't seem to be possible.
    – Karan
    Jun 12, 2015 at 15:53
  • 1
    Yes, there exists a way to achieve this; an uncomfortable way but exists via changing some Exif/TIFF metadata. The task is scriptable...
    – JosefZ
    Jun 12, 2015 at 20:17
  • Adding numbers in EXIF tags for each image, displaying the appropriate column in Explorer and sorting by it is a cumbersome and impractical solution IMO. Far better to rename the files than to go to such ridiculous lengths.
    – Karan
    Jun 14, 2015 at 16:55
  • why only the last 2 digits? So the digits before that will be sorted according to the normal lexicographical rules?
    – phuclv
    Mar 17, 2019 at 9:12

1 Answer 1

1

I have a ruby command line script that does batch file renaming. It happened to handle your request nicely:

bren *.jpg -o "(\d+)/n"

You can find the script at: bren.rb

Note: I have setup my computer in such a way that I can invoke the script by it's name, which is most likely not the case on your computer. In that case, just invoke the script like this:

ruby <PATH TO SCRIPT>\bren.rb *.jpg -o "(\d+)/n"
8
  • superuser.com/users/29956/codism Sorry for the silly question, but I need to have Ruby installed in my computer? And where I need to put the code to invoke?
    – user458186
    Jun 12, 2015 at 21:57
  • @user45816: Yes, you need ruby installed. I would suggest you to put the script in C:\rwin. However, you should be able to put the script anywhere you want.
    – Codism
    Jun 13, 2015 at 2:06
  • @Codism: How will this possibly aid in sorting the files as required while retaining their existing names? If the files are going to be renamed anyway then the entire question is pointless.
    – Karan
    Jun 14, 2015 at 16:58
  • @Karan: the command I gave does not perform renaming. What it does is to select all .jpg files in the current directory and order by the first number found in the file name. Without any "transformer", my program only lists the files are to be processed. You can find more information in the help message in the source code.
    – Codism
    Jun 15, 2015 at 14:56
  • @Codism: So just to be clear, your program displays files ordered by the first number found in their names, and doesn't affect the sort order of Explorer itself, right?
    – Karan
    Jun 19, 2015 at 7:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .