List selected files and dir: files in dirs are not "passed"

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

List selected files and dir: files in dirs are not "passed"

Post by *Axis »

Hi to all.


Example.
Here is "pippo" directory content:

Code: Select all

dir1
    |
    |
    file1.jpg
    file2.flac

file3.wav

file4.tiff

I'm in "pippo" directory and I select file3.wav, file4.tiff and dir1; then run "Create Checksum File(s)" command: such command will calculate the checksum of file3.wav, file4.tiff, file1.jpg (inside dir1) and file2.flac (inside dir1).

I would need such behavior because I'm forced to use other hashing algorithms (blake2, xxhash, etc.), BUT...

the lists in the temp files (%L, %F, %UL, %UF, etc.) DON'T allow to do that, they don't grab files within selected directories, they grab files in working directory ("pippo" directory) and directory names only, so taking the previous example the elements that are in the list are "dir1" (dir1 name only, not the files inside), "file3.wav" and "file4.tiff".


Any solution?


Many thanks
User avatar
Dalai
Power Member
Power Member
Posts: 9388
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: List selected files and dir: files in dirs are not "passed"

Post by *Dalai »

I guess you're looking for branch view (Ctrl+B). With that, all files in a directory and all its subdirs are shown and can be selected (and thus passed via %L).

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

Re: List selected files and dir: files in dirs are not "passed"

Post by *Axis »

Dalai wrote: 2020-02-20, 13:18 UTC I guess you're looking for branch view (Ctrl+B).
I never use the branch view and It would be a further step in the commands chain (and the text file generated with all the hashes inside would be confusing with all files at the same path level). Unfortunately It's the only way, right? :?

Thanks
User avatar
Dalai
Power Member
Power Member
Posts: 9388
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: List selected files and dir: files in dirs are not "passed"

Post by *Dalai »

Yes, it's a further step, but not an issue unless it's a complex directory structure.
Axis wrote: 2020-02-20, 15:25 UTC (and the text file generated with all the hashes inside would be confusing with all files at the same path level).
What are you talking about? When passing the file list via %L, full paths are stored in the checksum file. Or rather it depends on how you create the checksums, because as far as I understand it, you call some external tool (TC can't create checksums via %L parameter).

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: List selected files and dir: files in dirs are not "passed"

Post by *petermad »

2Axis
and the text file generated with all the hashes inside would be confusing with all files at the same path level
No, if you use %L, %UL or %WL the full paths are stored in the temp file, also if you use it in Branch view.

You can make a Branch view for selected dirs and files only by pressing Shift+Ctrl+B ( cm_DirBranchSel ).
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

Re: List selected files and dir: files in dirs are not "passed"

Post by *Axis »

petermad wrote: 2020-02-20, 17:30 UTC You can make a Branch view for selected dirs and files only by pressing Shift+Ctrl+B ( cm_DirBranchSel ).
Ok, thanks to all.

But honestly..., was it not easier to create a list using the same (and more complete) function used when invoking the "Create Checksum File(s)" command? :?
User avatar
Dalai
Power Member
Power Member
Posts: 9388
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: List selected files and dir: files in dirs are not "passed"

Post by *Dalai »

Well, technically TC does what you told it to do: it passes the selected objects (%L) in a list to some command, be it files or directories. And remember that command parameters like %L are not necessarily the same, or as powerful, as TC's internal functions/features.

If you need the files in subdirectories, it shouldn't be a problem to wrap the command around some script that finds all files recursively (like "dir /s /b" command in a CMD), or find other ways in TC like branch view or search result. If you need help writing scripts, just ask, and I'm pretty sure someone can help you. Over the years, a lot of topics came up with good ideas with regards to scripts, specifically suited for the task at hand.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: List selected files and dir: files in dirs are not "passed"

Post by *petermad »

2Axis
You can make a button that makes a the list of files automatically:

Put this command in your usercmd.ini file:

Code: Select all

[em_make_hashlist]
cmd=%COMSPEC% /C
param=copy %UL HASHLIST.txt
iconic=1
Then make this button:

Code: Select all

TOTALCMD#BAR#DATA
cm_DirBranchSel,cm_SelectAll,em_make_hashlist,cm_DirBranch

wciconex.dll,50
Make HASHLIST.txt file for selected dirs and files


10448
To make the button:
1. Mark the green text above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctri+C).
3. Right click on TC's buttonbar and choose "Paste".
Mark the directories and files you want in the list and press the button. HASHLIST.txt will be created in the base dir, to be used with your external hashing program.

If you give me the full path to your external hashing program, and the parameters you need to be used (especially the parameter to read a listfile), the I can make a button that does it all for you.
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Axis
Junior Member
Junior Member
Posts: 88
Joined: 2015-07-14, 18:53 UTC

Re: List selected files and dir: files in dirs are not "passed"

Post by *Axis »

petermad wrote: 2020-02-20, 23:54 UTC Then make this button:

Code: Select all

TOTALCMD#BAR#DATA
cm_DirBranchSel,cm_SelectAll,em_make_hashlist,cm_DirBranch

wciconex.dll,50
Make HASHLIST.txt file for selected dirs and files


10448
Btw, what's the meaning of the precise number 10448?

petermad wrote: 2020-02-20, 23:54 UTC If you give me the full path to your external hashing program, and the parameters you need to be used (especially the parameter to read a listfile), the I can make a button that does it all for you.
I usually use the buttons as little as possible, I'm a noob (I put the command line/parameters mostly in the Start menu or em_commands to be launched with shorcut key), but given your availability I am certainly not picky :)


Anyway, ok, let's try with xxhsum ( https://www.mankier.com/1/xxhsum ):

1) windows console program path: %commander_path%\MyTools\xxhsum.exe
2) xxhsum's syntax: xxhsum [arg] [filenames]
3) In my specific case: xxhsum.exe -H1 [filenames] > check.xxh64
(I don't know if ">" is right or ">>" is more appropriate; check.xxh64 is the text file with calculated hashes)



Thanks Peter (for your extended menus too)
User avatar
Ovg
Power Member
Power Member
Posts: 756
Joined: 2014-01-06, 16:26 UTC

Re: List selected files and dir: files in dirs are not "passed"

Post by *Ovg »

> - will overwrite existing file with hashes.
>> - will append to existing file with hashes.
It's impossible to lead us astray for we don't care even to choose the way.
#259941, TC 11.01 x64, Windows 7 SP1 x64
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: List selected files and dir: files in dirs are not "passed"

Post by *petermad »

2Axis
The command in the usercmd.ini file would look like:

Code: Select all

[em_make_hashlist0]
cmd=%commander_path%\MyTools\xxhsum.exe -H1
param=%UL > check.xxh64
iconic=1
or maybe:

Code: Select all

[em_make_hashlist0]
cmd=%commander_path%\MyTools\xxhsum.exe -H1
param=%UL > %Pcheck.xxh64
iconic=1
to make sure the check.xxh64 file ends up in the current directory.

Then you can make a second em_command:

Code: Select all

[em_make_hashlist]
cmd=cm_DirBranchSel,cm_SelectAll,em_make_hashlist0,cm_DirBranch
icon=wciconex.dll,50
menu=Make xxhsum hashlist for selected dirs and files
Then you can use em_make_hashlist in th Start menu, the Main Menu, as an assigned Keyboard shortcut, in the Command line, in the Directory hotlist, or in a Button.

The two lines: "icon=" and "menu=" are for using the command in a button.

I cannot test this, since I don't have xxhsum.exe.
I assume that [filenames] means a file with a list of filenames, and that it does not have to be preceded with for example @ (like @file.txt) as it is not uncommon.
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: List selected files and dir: files in dirs are not "passed"

Post by *petermad »

2Axis
Btw, what's the meaning of the precise number 10448?
It has to do with the number of em_commands you have in both the usercmd.ini and a possible wcmd_<lng>.ini file (that matches your wcmd_<lng>.mnu file). it is the number of those em_commands used in the Main menu and the Button bars + 10000, and since i have 435 em_command in my Main menu and some more in the two button bars that adds up to 10448.

The number is inserted if you use a cm_command or and em_command in the Command field for the button. For a cm_command it is the number of the command as you see it in the totalcmd.inc file that is inserted.

The number is inserted automatically when you right-click on a button an choose "Copy" to copy it to the clipboard.

If you copy a button that does not have an em_command or cm_command the value will be -1.
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply