Sorting files by specific rules

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Testing
Posts: 6
Joined: 13 Sep 2014 19:18

Sorting files by specific rules

Post by Testing »

Hi. :kidding: I'm testing XYplorer for a week now, and like I already mentioned, this is a terrific program.

But I have trouble finding a very specific function (and believe me, I looked everywhere, in the FAQ as well): To sort files by specific naming schemes. For example, if there's a "+" at the beginning of the name of a file/folder, I would like it to be at the beginning of the file list.

I thought "View | Sort by" could be what I'm looking for, since there seem to be custom presets, but somehow it wasn't what I was looking for. Then I found "Configuration | Information | Custom Columns", but I actually have trouble to comprehend what it is and how I use it.

It would be incredibly useful for me if XYplorer had a function to sort like I described. :)

admin
Site Admin
Posts: 63600
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Sorting files by specific rules

Post by admin »


highend
Posts: 14239
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Sorting files by specific rules

Post by highend »

E.g.:

Code: Select all

 $first = substr("<cc_name>", 0, 1);
 if ($first LikeI "+") {
     return $first;
 }
This returns "+" in that column and all items beginning with "+" would be on the top (if you take this column for sorting).
You can replace the + with any other character if necessary...
One of my scripts helped you out? Please donate via Paypal

Testing
Posts: 6
Joined: 13 Sep 2014 19:18

Re: Sorting files by specific rules

Post by Testing »

@admin & highend: This is incredible (though really hard to find for normal users, I think)! The example worked like I hoped it would. Honestly, this will make my life so much easier, you have no idea. :biggrin: I'll definitely buy the lifetime license the next days, especially since it's on sale now. :kidding:

Also, I read the whole linked portion, and I understand most of it, but sadly not everything (I tried to learn programming a few years back, but had to drop it). I'll have to go to sleep now, but I'll definitely want to look more into it tomorrow. Can you link me more about that? I especially want to know how to exclude files with specific characters and use it together with the already posted example (listing some files with a specific character and exclude files without it, for example), so I would really appreciate an example to that as well.

Really, great job with XYplorer.


Edit: Oh, another maybe related thing, but I don't know if that's even possible: Is there any way XYplorer could show specific extensions as different ones and handle them differently this way? I'm asking because of my other problem. I found a workaround, but I always have to rename files from zip/rar to cbz/cbr. Even by doing it in batches it's somewhat annoying.

Edit 2: Last minor question and now I'm really off: How do I change the size of the column? XYplorer doesn't display the name of it fully and I can't just use drag and drop. :?

highend
Posts: 14239
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Sorting files by specific rules

Post by highend »

I especially want to know how to exclude files with specific characters and use it together with the already posted example (listing some files with a specific character and exclude files without it, for example)
Real world examples, please...

You mean something like:
Include: +Crazy.mp3
Exclude: +World-Fire.mp3

Exclude the second because it contains e.g. a dash (but it would be included normally because it starts with a "+")?

Code: Select all

 $exclude = "-";
 $first = substr("<cc_name>", 0, 1);
 if ($first LikeI "+" && strpos("<cc_name>", $exclude) == -1) {
     return $first;
 }
One of my scripts helped you out? Please donate via Paypal

Testing
Posts: 6
Joined: 13 Sep 2014 19:18

Re: Sorting files by specific rules

Post by Testing »

highend wrote:Real world examples, please...
I'm sorry if I wasn't very clear, but you got it right. Yes, I want to list folders/files at the beginning of a file list if they have, for example, "+" at the beginning" and exclude them completely (so that they don't even show up) if they have a "-" at the beginning. But your posted example unfortunately doesn't work.

highend
Posts: 14239
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Sorting files by specific rules

Post by highend »

My example is fine but you didn't mention that those files shouldn't show up at all...

"Excluding" in the context of column sorting doesn't mean "hide".

You're looking for VF (visual filters) to achieve that.

E.g.:

Code: Select all

"|Exclude names with dashes" !*-*
The name of the visual filter at the beginning (up but not including the !*-*) isn't mandatory
and the filter itself means:
Exclude all files / folders that have a dash anywhere inside them.
One of my scripts helped you out? Please donate via Paypal

Post Reply