I have a kind of general text manipulation question, but I know how good some of your xy scripting gurus are, so I figured it was worth asking here. Of course, if there’s a better tool for the job, I’d be equally happy to be pointed in the right direction.
I would like to alpha sort the lines (contents) of all the files in a folder, or selection of files and folders, recursively.
Is xyscripting a sensible way to approach this? If so, would anyone be kind enough to write this? This is for a mobile game wiki that I edit and not for any kind of business application (though I’m sure someone would find it useful for that).
Thanks!
Edit: after the file contents have been alphabetised, I then feed them through BeyondCompare to find out what has changed between versions of the game so I can update the wiki…
Recursive alpha sort the contents of selected files/folde
-
- Posts: 744
- Joined: 28 Jul 2006 13:15
- Location: Kent, UK
- Contact:
Recursive alpha sort the contents of selected files/folde
Used to update to the latest beta every day. Now I have children instead…
Windows 10 Pro x64 (everywhere except phone…)
Windows 10 Pro x64 (everywhere except phone…)
Re: Recursive alpha sort the contents of selected files/fold
Foreach loop over all selected files
Readfile to get the content
Formatlist the content recursively
Writefile the new content back
On vacation no time to write real code...
Readfile to get the content
Formatlist the content recursively
Writefile the new content back
On vacation no time to write real code...
One of my scripts helped you out? Please donate via Paypal
Re: Recursive alpha sort the contents of selected files/fold
FYI, Beyond Compare can perform the sorting for you.
First ensure you have a "Sorted" format defined under Tools > File Formats... (included by default in BC 4): Then when you're comparing files there's a drop-down that you can use to select "Sorted" comparison (EDIT: You must do this in each pane.): If you wanted to have BC automatically apply the sorting you could configure the Sorted format's General > Mask field to match your files.
-----------------
Also, while XY scripting can be used to sort the files, Windows ships with a sort program which might be a better choice.
Hope that helps!
First ensure you have a "Sorted" format defined under Tools > File Formats... (included by default in BC 4): Then when you're comparing files there's a drop-down that you can use to select "Sorted" comparison (EDIT: You must do this in each pane.): If you wanted to have BC automatically apply the sorting you could configure the Sorted format's General > Mask field to match your files.
-----------------
Also, while XY scripting can be used to sort the files, Windows ships with a sort program which might be a better choice.
Hope that helps!
-
- Posts: 744
- Joined: 28 Jul 2006 13:15
- Location: Kent, UK
- Contact:
Re: Recursive alpha sort the contents of selected files/fold
I do have a licence for BC4, so I will probably use that. Interesting about Sort! Thanks for everyone's help, I knew this would be the place to get answers
Used to update to the latest beta every day. Now I have children instead…
Windows 10 Pro x64 (everywhere except phone…)
Windows 10 Pro x64 (everywhere except phone…)