Sorting file name from the 12th character

English support forum

Moderators: white, Hacker, petermad, Stefan2

User avatar
spikey
Member
Member
Posts: 123
Joined: 2005-07-20, 08:37 UTC

Sorting file name from the 12th character

Post by *spikey »

I need to sort by file name but I need to ignore the first 12 characters

Can TC do this?
User avatar
silencer
Senior Member
Senior Member
Posts: 208
Joined: 2003-05-13, 13:18 UTC
Location: The Netherlands

Post by *silencer »

Yes..

- Create a custom column view
- Add column name: [=tc.name:12-]
- Sort on that column
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

regexp_wdx NameCutFirst12 Sort Custom Column

Post by *Stefan2 »

Only that you can't sort by that Custom Column

I wanted to post the same answer:
Add a Column with [=tc.name:13-]
For that syntax see "Here is a description of all available placeholders" at
http://www.ghisler.ch/wiki/index.php/Multi-rename_tool


- - -

Over there is a trick with an additional plugin >
http://ghisler.ch/board/viewtopic.php?p=212332#212332



regexp_wdx
https://totalcmd.net/plugring/regexp_wdx.html

Install that plugin, then edit the INI
...TC\plugins\wdx\regexp\regexp.ini

[Regexp]
Rule=NameCutFirst12

[NameCutFirst12]
Find=^(.){12}(.*)
Change="$2"
Substitute=1
Others=0




Next create a Custom Column with [=regexp.Result]

Here is how to create a Custom Column >
http://ghisler.ch/board/viewtopic.php?p=322029#322029

1: Right-click on the tab headers.
2. Click "Configure custom columns".
3. Click the button "New"
4. In the Name field write e.g. "Sort 13th"
5. Click the "Add column" button.
6.Click the "+" button to the far right.
7. Under Plugins: click "regexp".
8. and select: "Result".
[=regexp.Result]
9. Click OK 3 times.



Or see TC menu "Configuration > Custom columns" and
http://www.ghisler.ch/wiki/index.php/Custom_columns





 
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

"filesys" plugin [=filesys.CutNameStart.12] Sort C

Post by *Stefan2 »

Ghislers' "filesys" sample plugin works here too

[=filesys.CutNameStart.12]
Possible values: 0-20

http://ghisler.ch/board/viewtopic.php?p=259748#259748





 
User avatar
milo1012
Power Member
Power Member
Posts: 1158
Joined: 2012-02-02, 19:23 UTC

Post by *milo1012 »

For the sake of completeness, my PCREsearch plug-in can do this as well.
With PCREsearchConfig.exe create or modify a field and use:
Regular Expression:

Code: Select all

^.{12}(.*)
or if you want to discard the file extension:

Code: Select all

^.{12}(.*?)(\.[^\.]+)?$
Replace String

Code: Select all

$1
Field type
[•]String output
(or "First match string output")

Field options
[✓]Search in filename only
TC plugins: PCREsearch and RegXtract
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

I support a wish to sort by visible values.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Post by *petermad »

I support a wish to sort by visible values.
Support +++++++
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:

Post by *ghisler(Author) »

The problem with that is that fields like date/time, numeric etc. will then be sorted alphabetically - normally not what you want...
Author of Total Commander
https://www.ghisler.com
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

ghisler(Author),
Well, I think you can add a note that partial strings are strings and sorted as strings...
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

How about:

Allow to add one column in "Custom Columns" with a special name like "SpecialUserSort".

The content/plugin of that column is not important, only the special name of the column.

If a user use that special column name, he knows what he does (explained in help)

Perhaps additionally disable the possibility to sort the default size and date/time columns
at the same time as long as that "Custom Columns" with that special column is active.


Then we can simply use "[=tc.name:13-]" in that SpecialUserSort" column.




 
User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

Stefan2,
I'd prefer a checkbox "Sort by visible values" either in the global settings or per custom column.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Hacker wrote:Stefan2,
I'd prefer a checkbox "Sort by visible values" either in the global settings or per custom column.

Roman
Yes, fine with me too. We just collect ideas for Christian to implement such feature without breaking old rules.




 
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Actually I don't think that someone will expect old-style sorting for partial strings or use it...
User avatar
spikey
Member
Member
Posts: 123
Joined: 2005-07-20, 08:37 UTC

Post by *spikey »

Thanks for all the replies. My head is spinning on account of the technical fiddling to make this work! I didn't think this would be so awkward!

If I have understood correctly, out of all the options PCREsearch is perhaps the easiest and also most flexible if I want to change the number of ignored characters. However PCREsearch's options look so extensive I don't really know where to start. Other solutions to edit the INI file seem too awkward for fast use.

Here is my requirement in a bit more detail. My initial 12 characters are used to hard code a date-time stamp into the name of my voice-memo files but I want to sort by the remainder of the description after the 12th character and not the date. (Sometimes I may write a date stamp using fewer than 12 characters.)

I can't think of any other file manager more flexible than TC, so I guess I'm a bit stuck.
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Add Custom Column with [=filesys.CutNameStart.13]

Post by *Stefan2 »

This is the easiest way for you:



1) Download the plugin

http://ghisler.fileburst.com/content/wdx_filesys.zip

Save it to your local download folder.




2) Inside of TC, go to that download folder and double click the ZIP file:

Code: Select all

---------------------------
       wdx_filesys.zip
---------------------------
This archive contains the following Total Commander plugin/addon:

filesys sample plugin v2.3 (ANSI+Unicode)

Do you want to install it?
---------------------------
        Ja        Nein   
---------------------------
Click at Yes.

(I think you do not have to close and restart TC, but do it if it doesn't work)






Next create a Custom Column with [=filesys.CutNameStart.13] (Possible values: 0-20)


1: Right-click on the tab headers.
2. Click "Configure custom columns".
3. Click the button "New"
4. In the Name field write e.g. "Sort at 13th"
5. Click the "Add column" button.
6.Click the "+" button to the far right.
7. Under Plugins: click "filesys >".
8. and select: "CutNameStart > 13".
You may have to adjust the number, possible values are 0 to 20.
You may also want to add "tc > writedate <default>", "tc > size <default>" and "tc > attributestr" to complete the view.
9. Click OK 3 times.


Now you have a column named "Sort at 13th" on which you can click to sort.




If you are done, Right-click on the tab headers and chose "Full View" again for the normal, default columns.



- - -


EXAMPLE:


CustomColumn with WDX-plugin "filesys"
Using plugin parameter: "filesys.CutNameStart.4".
Result: start filename at 5th sign.
Also that CustomColumn can be sorted by clicking at the column header.

Code: Select all

Name:                |  filesys.CutNameStart.4
-------------------------------------------------------------------
JustAsexample.txt       Asexample.txt
LastButnotleast.txt     Butnotleast.txt
TestC-Kopie.txt         C-Kopie.txt
1234DjustATest.txt      DjustATest.txt
Afilename is this.txt   ename is this.txt
AnotHername is here.txt Hername is here.txt
ZepelinTest- Kopie.txt  linTest- Kopie.txt
TestTheplugin.txt       Theplugin.txt




Sorted default by Name coulmn:

Code: Select all

Name:                |  filesys.CutNameStart.4
-------------------------------------------------------------------
1234DjustATest.txt        DjustATest.txt
Afilename is this.txt     ename is this.txt
AnotHername is here.txt   Hername is here.txt
JustAsexample.txt         Asexample.txt
LastButnotleast.txt       Butnotleast.txt
TestC-Kopie.txt           C-Kopie.txt
TestTheplugin.txt         Theplugin.txt
ZepelinTest- Kopie.txt    linTest- Kopie.txt

.

 
Post Reply