Page 1 of 1

Save selection to file with paths

Posted: 2014-12-19, 03:54 UTC
by andres992
Presently, there is the command cm_SaveSelectionToFile (in Mark menu), which creates a txt file of the selected file names. But the txt file does not contain paths. When I use this command after Ctrl+B, then I get some kind of "half-paths".

I am in a situation where I need such a txt file containing a file list with full paths on every line. I can do it now by:

(1) selecting the files to be listed;
(2) Mark -> Copy files with path to clipboard;
(3) create an empty txt file
(4) paste;
(5) save the txt file.

However, it would be a little handier if there was a command in the Mark menu, called "Save selection to file with paths".

Posted: 2014-12-19, 07:35 UTC
by MVV
What do you want to do with such list? There are commands that copies selected files with paths to clipboard (cm_CopyFullNamesToClip or cm_CopyNetNamesToClip) so you can then save such list. If you need to pass such list to some program, you can use %L (or %UL or %WL depending on desired charset, help describes them all) parameter from TC buttonbar button or user-command, and it will be substituted with path to temporary filelist. E.g. add a button with command notepad.exe and paramerer %WL and try clicking it. :wink:

Note that you can open buttonbar configuration and look through huge list of available internal commands, you'll find a lot of commands that are absent in default main menu. Main menu may be edited, you can add internal commands or custom user-commands there.

Posted: 2014-12-19, 21:02 UTC
by andres992
It was just a suggestion. I would need such a command but I can do without it as described above. I could even do without TC but that would be a sad life :D

There is the similar command "Save selection to file" and certainly the Mark menu would be shorter, perhaps more economical without it but the command is still in the menu.

I could not find an internal command (cm_x) for such action that I asked for.

In reply to your question: yes, I need to pass that list to another program but not on the command line. I will need to pass that list to another program as a txt file.

Posted: 2014-12-19, 22:14 UTC
by ZoSTeR
+ support

%L implies hunting for the file. This wouldn't

Posted: 2014-12-19, 22:36 UTC
by sqa_wizard
%L implies hunting for the file. This wouldn't
Well it's quiet hot.

Just copy the follwing to your buttonbar and you get a button which copies the temporary filelist to a permanent "MyList.txt"

Code: Select all

TOTALCMD#BAR#DATA
cmd.exe /c copy
"%L" MyList.txt
%COMMANDER_PATH%\TOTALCMD.EXE,2



-1

Posted: 2014-12-19, 22:39 UTC
by HolgerK
Button code:

Code: Select all

TOTALCMD#BAR#DATA
%comspec% /c copy
"%WL" "%T\SelectedFiles.txt"
%comspec%
Selected files to list in target path

1
-1
2ZoSTeR
- No hunting for the list file
- No File-Select-Box
- Just a simple text file inside the target panel

Regards
Holger

Posted: 2014-12-20, 17:48 UTC
by MVV
Using e.g. AskParam it is possible to show nice dialog to enter list file name.

Posted: 2014-12-23, 22:00 UTC
by andres992
Thanks for the suggestions! The toolbar button works all right and is indeed faster than the method I described (although it leaves a bit less choice). The problem was not exactly that I could not get the task done, however. It can also be done by the method I first described.

By the logic of finding alternatives to anything (including by means of addons) and opposing any new feature because it could be done by other means — well, I guess that it is possible now to complete most tasks without adding anything to TC. Does it mean that nothing needs to be added to TC for that reason? As I see it, TC is there to make my life (and others' lives) easier, and therefore I suppose that any new features should not be measured just by their alternative feasibility through addons or scripting.

Maybe my suggestion was not worth it, I will not argue. But I think such things should be measured, inter alia, by user opinions, by the coding effort required and by how they would make tasks easier.

EDIT:
MVV wrote:Using e.g. AskParam it is possible to show nice dialog to enter list file name.
Could you please post an example of how this can be done?

Posted: 2014-12-23, 23:14 UTC
by ZoSTeR
While we're at it, why not an AutoIt example for good measure:

Code: Select all

FileCopy($CmdLineRaw, FileSaveDialog("Save Selection", "c:\", "All (*.*)"))
Just because something is achievable with scripting or other workarounds doesn't mean it shouldn't be available to casual users out of the box.
 

Posted: 2014-12-24, 14:35 UTC
by MVV
andres992,

Code: Select all

Command: AskParam.exe
Parameters: /c"Save selection to file" /t"%P%O.lst" /p"Save selection to:" /s0 cmd.exe /c "copy "%WL" "%%1""

Posted: 2015-01-08, 06:11 UTC
by andres992
MVV wrote:

Code: Select all

Command: AskParam.exe
Parameters: /c"Save selection to file" /t"%P%O.lst" /p"Save selection to:" /s0 cmd.exe /c "copy "%WL" "%%1""
Thanks, that worked nicely too!