Instruct TC to load filelist from command line

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
obmana
Junior Member
Junior Member
Posts: 53
Joined: 2013-08-28, 15:35 UTC

Instruct TC to load filelist from command line

Post by *obmana »

I'm using a script from within TC that produces text file with full paths to targeted files. Now I wanted to launch TC from command line and instruct it to read the created filelist, but I can' t see such switch in TC help file.

If it's of any importance, files in generated filelist are located in same folder, so for manual resolution, I could instruct TC to load the folder in which files reside and use "cm_LoadSelectionFromFile" button to browse for filelist file, and then use "cm_ShowOnlySelected" button to filter results, but this approach seems a bit involved considering initial task, so I thought to ask for possible better solution.

TIA
meisl
Member
Member
Posts: 171
Joined: 2013-12-17, 15:30 UTC

Post by *meisl »

If instead of - or from - your text file you could make a temporary folder and put symbolic links pointing to the targeted files there,
then you can invoke TC like so

Code: Select all

%COMMANDER_EXE% /O /L=C:\TempFolderWithSymlinks\
The `mklink` command is available from Win Vista upwards and requires admin rights. There are workarounds for 2000/XP.

But be careful if you're going to delete them. It is possible, under circumstances, that rather than the link *the target is deleted instead*!
So testing with dummy files is a good idea.

Even better would be IMHO a custom packer plugin that interprets your list. You would invoke TC then by

Code: Select all

%COMMANDER_EXE% /O /L=your-list.lst
EDIT: Hard links might actually be a better choice than symlinks (but packer plugin is still best I think). They're available from XP on via

Code: Select all

fsutil.exe hardlink create
but they cannot point across volumes (drives). They're basically additional names for the same file, and deleting the last name remaining actually deletes the file; which implies that they cannot point to non-existing targets like symbolic links.
User avatar
white
Power Member
Power Member
Posts: 6014
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

meisl wrote:Even better would be IMHO a custom packer plugin that interprets your list. You would invoke TC then by

Code: Select all

%COMMANDER_EXE% /O /L=your-list.lst
If you add a line at the top of the list containing drive and root folder (c:\) the diskdir plugin could be used. But the diskdir plugin doesn't support unicode. There is also the dirkdirw plugin supporting unicode, but I don't know if it is any good.

Another approach is to use search (search in @c:\path\filelist.txt, see Help) and feed the results to TC's file panel.
obmana
Junior Member
Junior Member
Posts: 53
Joined: 2013-08-28, 15:35 UTC

Post by *obmana »

I tried "diskdir" plugin which indeed can't handle Unicode.
"diskdirw" works fine if filelist is encoded in UTF-8 variant of Unicode, and that is the solution I'm using now. Thanks!

Using "@files.lst" in "Search in" input box of Search dialog with "*" pattern in "Search For" inputbox, and then saving the search and binding button to "LOADSEARCH" command is yet another fine approach.

I wish I was patient and wait for your replies before heading to ActiveX plugin, although exposed TC as COM object was another good find.


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

Post by *white »

obmana wrote:Using "@files.lst" in "Search in" input box of Search dialog with "*" pattern in "Search For" inputbox, and then saving the search and binding button to "LOADSEARCH" command is yet another fine approach.
The parameter "/S=F" introduced in TC 8.50 may be useful to you too.
obmana
Junior Member
Junior Member
Posts: 53
Joined: 2013-08-28, 15:35 UTC

Post by *obmana »

Indeed, using saved search from command line reduces one click, and still one ahead from "diskdirw" plugin, but lister window feed from search dialog is more useful to me
User avatar
white
Power Member
Power Member
Posts: 6014
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post by *white »

obmana wrote:..but lister window feed from search dialog is more useful to me
This is also available when using the command line parameter to start the search. If a Total Commander window is open, search results can be fed to TC's file panel.
meisl
Member
Member
Posts: 171
Joined: 2013-12-17, 15:30 UTC

Post by *meisl »

For completeness: diskdirw on totalcmd.net
obmana
Junior Member
Junior Member
Posts: 53
Joined: 2013-08-28, 15:35 UTC

Post by *obmana »

white wrote:
obmana wrote:..but lister window feed from search dialog is more useful to me
This is also available when using the command line parameter to start the search. If a Total Commander window is open, search results can be fed to TC's file panel.
If I understand your right, I guess I used wrong words, and would like to explain - by "lister window" I meant file panel window, like lister in a sense of file listview and not in a sense of lister plugin. So I find file panel fed from search dialog more useful, not file panel from "diskdirw" plugin ;) For example file panel from "diskdirw" can't, while file panel from search dialog can:

- display files from different locations (drives)
- show thumbnails
- send files to virtual panel
- filter nonexistent files
...
meisl
Member
Member
Posts: 171
Joined: 2013-12-17, 15:30 UTC

Post by *meisl »

Sorry for chipping in again,
obmana wrote:For example file panel from "diskdirw" can't, while file panel from search dialog can:

- display files from different locations (drives)
- show thumbnails
- send files to virtual panel
- filter nonexistent files
...oops. Haven't (yet) tried diskdirw myself, but I was assuming it would in fact provide all that.
You know, I'm looking for example plugins I could write using tc_java. This one looked like a good candidate since it's not too involved - until white mentioned diskdirw...

But now - if you'd still be interested in trying it - I'd write it. :?:
obmana
Junior Member
Junior Member
Posts: 53
Joined: 2013-08-28, 15:35 UTC

Post by *obmana »

Meisl, thanks for your replies and your offer. You are very kind.

I don't plan to load Java VM to do filelisting in TC, but why not write plugin? Perhaps others will find it useful and if that's you first try to write plugin sure useful experiance for you too :)
meisl
Member
Member
Posts: 171
Joined: 2013-12-17, 15:30 UTC

Post by *meisl »

Thanks obmana, for your kind words!

The (one!) JVM is loaded at TC startup, and when using the /O option (ie, send data to a currently running TC instance) there wouldn't be any noticeable lag.

Of course, actually trying Java plugins presupposes having installed tc_java once. I'm working on making that as easy as possible, too.

So well, I'll keep this one on my list for packer plugins, as it's got other aspects that make it a good example (for devs).
And maybe, eventually, you may want to take the effort of trying it, and reporting if you think whether it can compete with the other solutions proposed :)
obmana
Junior Member
Junior Member
Posts: 53
Joined: 2013-08-28, 15:35 UTC

Post by *obmana »

Sure Meisl, I'll try your plugin
Wish you luck
Post Reply