Sort files by Nth character

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Ammammata
Junior Member
Junior Member
Posts: 23
Joined: 2003-03-04, 18:16 UTC
Contact:

Sort files by Nth character

Post by *Ammammata »

I have a folder with several text files, whose name is a progressive number followed by underscore and the customer name, i.e.
000127_Porsche
000158_Maserati
000187_Porsche
000201_Ferrari
and so on...
I'd like to have them sorted starting from the Nth character, in this case N=8
000201_Ferrari
000158_Maserati
000127_Porsche
000187_Porsche
Right now I'm using a filter but I have to change it every time

thank you
/-\ /\/\ /\/\ /-\ /\/\ /\/\ /-\ T /-\
User avatar
white
Power Member
Power Member
Posts: 4593
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Sort files by Nth character

Post by *white »

I don't if this workaround is workable for you but you could do this:

Create a custom column for comments (because normal comment view cannot be sorted on comments)
Field contents: [=tc.comment]

Then copy the filenames starting from the 8th character to the comment.
Mark all your files and choose menu File/Change Attributes.
Check Change plugin attributes.
Plugin: tc
Property: comment
Value: [=tc.fullname:8-]
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Sort files by Nth character

Post by *Stefan2 »

Also there are

expander2 : http://www.ghisler.ch/board/viewtopic.php?p=151622#151622 _ _ split e.g. at " - " -signs for to show parts of the filename in different custom columns.
Regexp_wdx : https://www.ghisler.ch/board/viewtopic.php?p=93548#p93548 _ _ split filename with regular expressions for to show parts of the filename in different custom columns.
and FileSys : https://www.ghisler.ch/board/viewtopic.php?p=326052#p326052 _ _ start filename in custom column e.g. at 5th char with "filesys.CutNameStart.4" for to sort filenames at that spot.





HTH? :D


 
User avatar
white
Power Member
Power Member
Posts: 4593
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Sort files by Nth character

Post by *white »

Stefan2 wrote: 2022-08-30, 13:32 UTC and FileSys : https://www.ghisler.ch/board/viewtopic.php?p=326052#p326052 _ _ start filename in custom column e.g. at 5th char with with "filesys-CutNameStart:4"
You mean [=filesys.CutNameStart.7]? That wouldn't do any good. TC only sorts on (full) fieldname.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Sort files by Nth character

Post by *petermad »

You mean [=filesys.CutNameStart.7]? That wouldn't do any good. TC only sorts on (full) fieldname.
It seems to me that [=filesys.CutNameStart.7] does work, because the unit 7 is intrinsic to the plugin (unit values 0 - 20).

Maybe you are thinking of using [=filesys.CutNameStart:8-] - it will show the same as [=filesys.CutNameStart.7] but since it is TC making the substring, TC will still sort by the full fieldname.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Sort files by Nth character

Post by *ghisler(Author) »

Indeed [=filesys.CutNameStart.7] is meant for sorting, so I recommend that you use it for your purpose. You can make that extra column very narrow, just so you can click on the header.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4593
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Sort files by Nth character

Post by *white »

petermad wrote: 2022-08-30, 22:29 UTC
You mean [=filesys.CutNameStart.7]? That wouldn't do any good. TC only sorts on (full) fieldname.
It seems to me that [=filesys.CutNameStart.7] does work, because the unit 7 is intrinsic to the plugin (unit values 0 - 20).
You are right. Sorry, my mistake.
Post Reply