Button to move files to a specific/fixed directory

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
kodepr
Junior Member
Junior Member
Posts: 47
Joined: 2019-09-05, 08:13 UTC

Button to move files to a specific/fixed directory

Post by *kodepr »

Hi,

Is it possible to create a button that will move selected files to a directory/path that is specified in the button itself rather than to the path of the target directory?
I tried to add the path after the "cm_RenMov" but I didn't succeed that way.

Thanks in advance!
I'm currently using Total Commander Version 10.00 64bit
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Button to move files to a specific/fixed directory

Post by *Stefan2 »

You can use MS-DOS and PowerShell commands.
TC will provide you with parameters for selected files which you can process with DOS and PoSh.


Test this ,


This is an code for to exchange buttons. Select the code and right click at TCs buttonbar.

Code: Select all

TOTALCMD#BAR#DATA
cmd /k
ECHO %S
C:\Windows\system32\cmd.exe
TEST-Button for "ECHO %S"


-1
Select a few files (with and without space) and then click that button. A "DOS-Box" will open and shows the result.





For to copy a few files we need a loop to execute COPY for each file:

Code: Select all

TOTALCMD#BAR#DATA
cmd /k
?For %%I in (%S) do copy %%I "C:\Temp\kodepr\"
C:\Windows\system32\cmd.exe
TEST-Button für "COPY %S"


-1
ATTENTION: NO error handling, existing files will be overwritten without any warning

Select a few files (with and without space) and then click that button. A "DOS-Box" will open and shows the result on copying the files.
Note that TC adds quotes on its own (by using THIS parameter), IF he detect a space in file name.

There are many possibilities, depending what you wanna do.
The command line length is limited, so for more than a few files use better "%F" / "%L" and a script which parse the so created temp file line-by-line.
Press the [Help]-button in an open button dialog to read more about parameters.
Search the forum or ask for more help.


 
User avatar
nsp
Power Member
Power Member
Posts: 1948
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Button to move files to a specific/fixed directory

Post by *nsp »

As said by Stephan, you do not have any TC comand to move/copy into a specific folder. You can use TCBL it will create a batch file to process all files one by one.
For copy, you can use integration with a copy tool like FastCopy, TerraCopy or RoboCopy. Sample with FastCopy

Code: Select all

TOTALCMD#BAR#DATA
<PATH to>FastCopy.exe
 /srcfile_w="%WL"  /no_exec /to="<My target Folder>"
<PATH to>\FastCopy.exe,4
FastCopy
C:\tools\FastCopy\

-1
Another solution is to use a scripting language that will fill automatically the dialog when it show up you will have to create a powerpro,AHK,AutoIt script launch the copy (sending F5 or cm_copy) wait for the dialog and fill the target directory as set in parameter place...
User avatar
jinsight
Senior Member
Senior Member
Posts: 299
Joined: 2003-02-25, 19:47 UTC
Location: Wooster, Ohio, USA

Re: Button to move files to a specific/fixed directory

Post by *jinsight »

Sample with TeraCopy

TOTALCMD#BAR#DATA
%Commander_Path%\Addons\TeraCopy_64\TeraCopy.exe
Move *"%WL" --Full path to destination folder--
%Commander_Path%\Icons\bing.ico
TeraCopy Move to --Full path to destination folder--

0
-1
License #1945
Windows 10 Pro x64
Version 22H2 (OS Build 19045.3930)
TC 11.00 x64 and x86, Everything 1.5.0.1366a x64, QAP 11.6.3.1 x64
Post Reply