Hi, I've been wanting to automatically sort through an old archive of text files (link exports, exported bookmarks, various lists I've accumulated over the years) for a while now, without having to do it all by hand.
Three weeks ago, I finally got around to it. The JS script runs in XYplorer; it scans the name and contents of each file, detects keywords using regex, and moves them directly to the correct subfolder. I tested it on a little over 14,000 files it took all night to run but didn’t crash once and I was honestly pretty happy with the result. The regex gave me a hard time I had false positives everywhere at first, so I called a coworker who’s a bit better at coding this kind of thing than I am, and he helped me clean up the patterns. The real issue wasn’t so much the script as the list of categories itself I didn’t want to just make up my own folder names on a whim; I needed a pre-existing, consistent taxonomy for the detection to make sense... For that, I didn’t reinvent the wheel I just used the structure as a basis. It’s neatly divided into over 100 themes, which served as my reference grid for setting my keyword rules. In the end, the organization is pretty clean there are a few catch-all folders here and there, but nothing too bad. If anyone has tips for further refining detection based on content rather than name, I’d love to hear them.
Script for sorting by categories in XYplorer
-
RalphM
- Posts: 2139
- Joined: 27 Jan 2005 23:38
- Location: Cairns, Australia
Re: Script for sorting by categories in XYplorer
A) It probably could have been done in XY's own script language since you're running it in XY anyway.
B) You're not sharing your script but hope for input on how to refine it - good luck with that.
B) You're not sharing your script but hope for input on how to refine it - good luck with that.
Ralph 
(OS: W11 26H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)
(OS: W11 26H2 Home x64 - XY: Current x64 beta - Office 2024 64-bit - Display: 1920x1080 @ 125%)
-
Native2904
- Posts: 158
- Joined: 23 Apr 2025 18:48
- Location: Aachen
Re: Script for sorting by categories in XYplorer
Okay, I don’t know the files, but wouldn’t the standard features of XYplorer be sufficient here?
1. Flat View
2. Filter by extension and move the files to a subfolder
3. Filter by name or date
All of this can be done using the Filter Box, without any scripting wizardry.
1. Flat View
2. Filter by extension and move the files to a subfolder
3. Filter by name or date
All of this can be done using the Filter Box, without any scripting wizardry.
XYplorer Beta Club