Page 1 of 1
Sort files by Nth character
Posted: 2022-08-30, 10:46 UTC
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
Re: Sort files by Nth character
Posted: 2022-08-30, 11:22 UTC
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-]
Re: Sort files by Nth character
Posted: 2022-08-30, 13:32 UTC
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?
Re: Sort files by Nth character
Posted: 2022-08-30, 14:31 UTC
by white
You mean [=filesys.CutNameStart.7]? That wouldn't do any good. TC only sorts on (full) fieldname.
Re: Sort files by Nth character
Posted: 2022-08-30, 22:29 UTC
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.
Re: Sort files by Nth character
Posted: 2022-08-31, 07:04 UTC
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.
Re: Sort files by Nth character
Posted: 2022-08-31, 07:21 UTC
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.