"New folder with selection": move selected files to a new created folder
Moderators: Hacker, petermad, Stefan2, white
"New folder with selection": move selected files to a new created folder
Hi, all!
On a mac there is a neat function in Finder, it is called "new folder with selection". You select some files and the command places them into a folder; you just need to type a folder name.
Can something like this be done in TC? Select files, hit a shortcut and the files get moved into a directory with the title selected to type.
Thank you.
On a mac there is a neat function in Finder, it is called "new folder with selection". You select some files and the command places them into a folder; you just need to type a folder name.
Can something like this be done in TC? Select files, hit a shortcut and the files get moved into a directory with the title selected to type.
Thank you.
Re: New folder with selection
Hi Achiles,
Try selecting some files, pressing F6, typing "foldername\", and hitting Enter. Is that what you need?
Roman
Try selecting some files, pressing F6, typing "foldername\", and hitting Enter. Is that what you need?
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.
Re: New folder with selection
Or Shift+F6 (as long as you are moving files on the same drive)
Re: New folder with selection
2Achiles
When you copy/move files with F5/F6 you can just edit the first field for your desired target folder. if the target folder is a subfolder to the current folder you can just enter the folder name without drive and path. if the folder does not exist you have to add a \ to the end of the folder name, then TC will create the folder before copying.
When you copy/move files with F5/F6 you can just edit the first field for your desired target folder. if the target folder is a subfolder to the current folder you can just enter the folder name without drive and path. if the folder does not exist you have to add a \ to the end of the folder name, then TC will create the folder before copying.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: New folder with selection
Wow, that's awesome! Thank you, TC rules.petermad wrote: 2023-09-08, 12:12 UTC 2Achiles
When you copy/move files with F5/F6 you can just edit the first field for your desired target folder. if the target folder is a subfolder to the current folder you can just enter the folder name without drive and path. if the folder does not exist you have to add a \ to the end of the folder name, then TC will create the folder before copying.
Re: New folder with selection
thanks 'Hacker' too. For some reason, I didn't understand your reply correctly and my test failed 

Re: New folder with selection
I tried the F5 and F6 method, and this accomplishes the task. Thanks for showing us that trick.
Still, to the the original poster's suggestion, it would be nice if this could be done with less clicks and typing.
I really love how, in Total Commander, I can select a file and hit F7 and the new folder proposed name is the file name. That saves steps! If I want to take a bunch of files and put them in a new folder of the root directory this is a bit more task laden, so here is an ease of use suggestion
Image: https://i.ibb.co/sq0xtn9/Total-Cmd-Move-Sel-into-New-Folder-mockup.png
This would be a real time saver and make directory cleanup so fast and easy to do. I hope you consider this suggestion.
Still, to the the original poster's suggestion, it would be nice if this could be done with less clicks and typing.
I really love how, in Total Commander, I can select a file and hit F7 and the new folder proposed name is the file name. That saves steps! If I want to take a bunch of files and put them in a new folder of the root directory this is a bit more task laden, so here is an ease of use suggestion
- User select selects one or more files and hits F7.
- if one file is selected, the new folder name suggestion is the filename of the single selected file (as normal)
- if multiple files are selected, the new folder name suggestion is the filename of the LAST selected file
- The New folder (directory) popup window contains a check box option: "Move selected files into new folder".
- Checking this box will move the selected files into a new folder named by default as the las selected file, or typed in by the user.
Image: https://i.ibb.co/sq0xtn9/Total-Cmd-Move-Sel-into-New-Folder-mockup.png
This would be a real time saver and make directory cleanup so fast and easy to do. I hope you consider this suggestion.

Re: New folder with selection
2DaveCmd
In my Extended Menus (see signature) I use these em_commands for that task:
You can also do it with a multi-command:
If you want the moving process to start automatically you can use:
In my Extended Menus (see signature) I use these em_commands for that task:
Code: Select all
[em_moveallnewdir]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo Error) else if not exist "%T" (echo Error else if exist %Y%P%S1\* (echo Error else if exist "%T%O" (echo Error else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WL`) do if not exist "%%n\*" xcopy "%%n" "%T%O\" /H /R /K /Y && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WL`) do if not exist "%%n\*" del "%%n" /F /A
menu=Move marked files to directory in opposite panel with name as file under cursor
button=wcmicons.dll,63
iconic=1
[em_moveallnewdir2]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo Error) else if not exist "%T" (echo Error) else if exist %Y%P%S1\* (echo Error) else if exist %T%N (echo Error) else chcp 65001 && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WL`) do if not exist "%%n\*" xcopy "%%n" "%T%O.%E\" /H /R /K /Y && %%COMSPEC%% /C for /F "usebackq delims=" %%n in (`type %WL`) do if not exist "%%n\*" del "%%n" /F /A
menu=Move marked files to directory in opposite panel with name + extension as file under cursor
button=wcmicons.dll,63
iconic=11
You can also do it with a multi-command:
Code: Select all
[em_moveallnewdir]
cmd=cm_MkDirOther,cm_Return,cm_FocusTrg,cm_MoveOnly
menu=Move marked files to directory in opposite panel with name as file under cursor
button=wcmicons.dll,63
If you want the moving process to start automatically you can use:
Code: Select all
[em_moveallnewdir]
cmd=cm_MkDirOther,cm_Return,cm_FocusTrg,cm_RenMov /G
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: "New folder with selection": move selected files to a new created folder
2petermad
First off, I wanted to say that I was blown away by your Extended Menus plugin. That is a tremendous amount of work, and I will explore it more, thank you.
I was trying some of your code as a button and I am stumped. This is what I have so far:
So I select my files, it prompts me to name the folder, defaulting to the name of the file under my cursor (perfect!), but it does not move the files into the directory. It created the folder in the same panel, but the files are not moved and the new folder is empty.
I was attempting to adapt your code so that the files I selected would move into the new folder in the SAME panel. I don't want the new folder and files to be in the other panel. Does this make sense? I would be grateful for any help.
First off, I wanted to say that I was blown away by your Extended Menus plugin. That is a tremendous amount of work, and I will explore it more, thank you.
I was trying some of your code as a button and I am stumped. This is what I have so far:
Code: Select all
[em_moveallnewdir]
cm_MkDir,cm_Return,cm_MoveOnly
I was attempting to adapt your code so that the files I selected would move into the new folder in the SAME panel. I don't want the new folder and files to be in the other panel. Does this make sense? I would be grateful for any help.

Re: "New folder with selection": move selected files to a new created folder
2DaveCmd
For that you need two em_commands:
Use the second one (em_moveallnewdir) for the execution.
I was attempting to adapt your code so that the files I selected would move into the new folder in the SAME panel.
For that you need two em_commands:
Code: Select all
[em_moveallnewdir0]
cmd=cm_RenMov
param=/GT="%Q%N\"
[em_moveallnewdir]
cmd=cm_MkDir,em_moveallnewdir0
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: "New folder with selection": move selected files to a new created folder
2petermad
Oh Splendid! It works perfectly, thanks! I never thought it needed two em_ commands.
One least question: I made a button with your original code to move the new folder to the opposite panel. It works fine, but the after executing the code, Total Commander's target panel is up a directory level, inside the newly created and moved folder. Is it possible to get the target panel to move back to (or remain in) the parent directory?
Here is the code I tried but it moves to the parent folder of the source panel instead:
I tried many different things including attempts with cm_FocusSrc and even splitting the commands, but to no avail. Any suggestions?
Thank you for your patience
Oh Splendid! It works perfectly, thanks! I never thought it needed two em_ commands.


One least question: I made a button with your original code to move the new folder to the opposite panel. It works fine, but the after executing the code, Total Commander's target panel is up a directory level, inside the newly created and moved folder. Is it possible to get the target panel to move back to (or remain in) the parent directory?
Here is the code I tried but it moves to the parent folder of the source panel instead:
Code: Select all
[em_moveallnewdirtarg]
cm_MkDirOther,cm_Return,cm_FocusTrg,cm_RenMov /G,cm_FocusTrg,cm_GoToPreviousDir
Thank you for your patience

Re: "New folder with selection": move selected files to a new created folder
2DaveCmd
But it is unpredictable how long a wait you need, it can be influenced by processor speed, and numver of files to be moved.
It would be better to use another set of commands:
You can either add cm_Wait 100 to yiour command:Is it possible to get the target panel to move back to (or remain in) the parent directory?
Code: Select all
[em_moveallnewdirtarg]
cm_MkDirOther,cm_Return,cm_FocusTrg,cm_RenMov /G,cm_Wait 100,cm_FocusTrg,cm_GoToPreviousDir
It would be better to use another set of commands:
Code: Select all
[em_moveallnewdirother0]
cmd=cm_RenMov
param=/GT="%Q%T%O\"
[em_moveallnewdirother]
cmd=cm_MkDirOther,cm_FocusTrg,em_moveallnewdirother0
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Re: "New folder with selection": move selected files to a new created folder
2petermad
Okay, I will give this a try, thank you.
I discovered a list of the special parameters:
https://www.ghisler.ch/wiki/index.php?title=Buttonbar#Special_parameters:
I do not see %Q listed anywhere.
What does %Q do?
Is this the correct list of parameters, or is there another list?
Okay, I will give this a try, thank you.
I discovered a list of the special parameters:
https://www.ghisler.ch/wiki/index.php?title=Buttonbar#Special_parameters:
I do not see %Q listed anywhere.
What does %Q do?
Is this the correct list of parameters, or is there another list?
Re: "New folder with selection": move selected files to a new created folder
2DaveCmd
Total Commander Help [F1] > [Index tab] >
> Change start menu - Parameters
or
> User defined menu - Parameters
Total Commander Help [F1] > [Index tab] >
> Change start menu - Parameters
or
> User defined menu - Parameters
%Q Turn off automatic quotation marks around certain parameters like %P%N when the name contains a space.
The user will then have to place them by himself.
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15
Re: "New folder with selection": move selected files to a new created folder
2DaveCmd
Run:
to see the Help for cm_commands with parameters
Run:
to see the Help for commands AND parameters (%P, %N, %Q etc.) for buttons and user commands
See beb's answer. It would not work for file and direrctory names with spaces without the %Q, because quotation marks are mandatory for the /T= parameter for cm_RenMov, so without %Q, paths with spaces would get double quoted.What does %Q do?
Run:
Code: Select all
hh.exe %COMMANDER_PATH%\TOTALCMD.CHM::dlg_choosecommand.htm
Run:
Code: Select all
hh.exe %COMMANDER_PATH%\TOTALCMD.CHM::dlg_configbuttonbar.htm
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar