Transfer dir with user defined drive

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
sujanlal
Junior Member
Junior Member
Posts: 26
Joined: 2007-12-08, 08:57 UTC

Transfer dir with user defined drive

Post by *sujanlal »

I am looking a command which transfer directory under cursor to the target panel but with user definded drive. I am daily synchronising D drive (source) and removable F drive (target) and consider the following situation.

1. I am already now D:\folder1\subfolder1 in left panel
2. I would like to have target or right panlel with folder F:\folder1\subfolder1

There is command cm_TransferLeft and cm_TransferRight, but it would be nice if we can transfer directory with user defined drive. However if the folder or user defined drive does not exist then it should work like normal cm_TransferLeft or cm_TransferLeft.

BTW, Why do we need the commands cm_TransferLeft or cm_TransferRight because the commands Target=Source does the same by simply activating rigth or left panel.

Thanks
User avatar
ts4242
Power Member
Power Member
Posts: 2081
Joined: 2004-02-02, 20:08 UTC
Contact:

Post by *ts4242 »

1. I am already now D:\folder1\subfolder1 in left panel
2. I would like to have target or right panlel with folder F:\folder1\subfolder1
1- Switch to D:\ in left panel and to F:\ in right panel
2- Execute cm_SyncChangeDir command
now each time you open a folder in Left or Right panel it will be opened in the other panel if it is contain a folder with the same name
BTW, Why do we need the commands cm_TransferLeft or cm_TransferRight because the commands Target=Source does the same by simply activating rigth or left panel.
cm_TransferLeft opens the folder or archive under the cursor in the right panel, but if the cursor is on a file, executing it will be looks like Target=Source
sujanlal
Junior Member
Junior Member
Posts: 26
Joined: 2007-12-08, 08:57 UTC

Post by *sujanlal »

1- Switch to D:\ in left panel and to F:\ in right panel
2- Execute cm_SyncChangeDir command
now each time you open a folder in Left or Right panel it will be opened in the other panel if it is contain a folder with the same name
I am aware of this command. But my concern is that if we are already in some folder and would like to have same folder in another panel but in different drive without going back to root drive on both panels.

Thanks.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50861
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Consider using an automatic command line tool for daily operations, like xcopy or CmdSync from
http://www.fileware.co.uk
Author of Total Commander
https://www.ghisler.com
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

2sujanlal
I am daily synchronising D drive (source) and removable F drive (target)
If the starting directory is always the same and you only need this for synchonizing,
you could call SYNCOPEN together with a previously saved configuration name,
including the two starting dirs.

Can be used in starter menu, as button, or in a user defined command.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
sujanlal
Junior Member
Junior Member
Posts: 26
Joined: 2007-12-08, 08:57 UTC

Post by *sujanlal »

If the starting directory is always the same and you only need this for synchonizing, you could call SYNCOPEN together with a previously saved configuration name, including the two starting dirs.
No. I am daily (almost) synchronizing but with different folders each day.
Let me elaborate my situation in another way. I am now in some folder "A" in D drive in left panel. How can i open same folder "A" in F drive (it exists in F drive) in the right panel with single click?


Consider using an automatic command line tool for daily operations, like xcopy or CmdSync from
http://www.fileware.co.uk
Synchronize tool of TC is very convenient for me, so i do not want other tool.

Thanks.
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

2sujanlal
After some testing: this should be your solution:
  • Download TCStartWithCommand 2.0 (discussion in a german thread).
  • Copy TcStartWithCommand.exe to your TC directory (where TOTALCMD.EXE is).
  • Create a button or starter menu entry or user defined command
    (I called it "em_SyncSamePathOtherDrive"):

Code: Select all

Command   : %COMSPEC% /c
Parameters: for %%e in ("%P") do cd /d "%%COMMANDER_PATH%%" & start TCStartWithCommand.exe /O /S /R="F:%%~pe" /X="cm_FileSync"
:arrow: This will open F:[current panel's path] in the opposite panel,
then start TC's synchronize tool.

---

If the synchronize tool doesn't need to be started automatically,
you can reach this easier, without external tools:

Code: Select all

Command   : %COMSPEC% /c
Parameters: for %%e in ("%P") do cd /d "%%COMMANDER_PATH%%" & start TOTALCMD.EXE /O /S /R="F:%%~pe"
---

[OT]: For synchronizing with a network share
(opens cm_FileSync with \\192.168.100.1\F\Tools for local directory F:\Tools,
"em_SyncSamePathNetDrive"):

Code: Select all

Command   : 
   %COMSPEC% /c
Parameters: 
   for %%e in ("%P") do for /F "usebackq delims=: tokens=1" %%d in ('%%e') do cd /d "%%COMMANDER_PATH%%" & start TCStartWithCommand.exe /O /S /X="cm_FileSync" /R="\\192.168.100.1\%%~d%%~pe"
Maybe someone finds this useful, too...


[Edit:]
Added missing double quotes around "%P" and "%%COMMANDER_PATH%%" -
and in em_SyncSamePathNetDrive removed the auto-generated ones from %%d.
Last edited by StatusQuo on 2008-01-11, 19:25 UTC, edited 2 times in total.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
sujanlal
Junior Member
Junior Member
Posts: 26
Joined: 2007-12-08, 08:57 UTC

Post by *sujanlal »

2StatusQuo

Thank you very much for your suggestion. I tried with your second option
f the synchronize tool doesn't need to be started automatically,
you can reach this easier, without external tools:
Code:
Command : %COMSPEC% /c
Parameters: for %%e in (%P) do cd /d %%COMMANDER_PATH%% & start TOTALCMD.EXE /O /S /R="F:%%~pe""

But this works perfectly if there is no space between folder. Could you or someone explain me how this commands works, is it dos command as i see blinking of dos window?

Another question- How can i define these commands as user defined command say "em_OpenSamePathOtherDrive" so that i can use shortcut for it.
User avatar
Clo
Moderator
Moderator
Posts: 5731
Joined: 2003-12-02, 19:01 UTC
Location: Bordeaux, France
Contact:

Read the beautiful Tuto…

Post by *Clo »

2sujanlal

:) Hello !
…How can i define these commands as user defined command say "em_OpenSamePathOtherDrive" so that i can use shortcut for it.
• You could give a glance HERE

:mrgreen: KR
Claude
Clo
Last edited by Clo on 2008-01-11, 10:40 UTC, edited 1 time in total.
#31505 Traducteur Français de TC French translator Aide en Français Tutoriels Français English Tutorials
sujanlal
Junior Member
Junior Member
Posts: 26
Joined: 2007-12-08, 08:57 UTC

Post by *sujanlal »

You could give glance HERE…
Thanks.
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

2sujanlal
But this works perfectly if there is no space between folder.
Oops, TC doesn't add double quotes around %P.
I updated the code above, thanks for reporting.

Now it should also work with paths containing spaces.
How can i define these commands as user defined command say "em_OpenSamePathOtherDrive"
Another description can be found at
http://www.ghisler.ch/wiki/index.php/User-defined_commands
Could you or someone explain me how this commands works, is it dos command
Yes, it is NT command line/batch code, an extended version of what was possible under DOS in earlier days.
Available from NT (4.0?) up to Vista.

---

What it does:

Code: Select all

for %%e in ("%P") do cd /d "%%COMMANDER_PATH%%" & start TOTALCMD.EXE /O /S /R="F:%%~pe"

Code: Select all

cd /d "%%COMMANDER_PATH%%"
Temporarily goes to TC install directory for running this.

Code: Select all

start TOTALCMD.EXE /O /S /R="F:%%~pe"
This is the core:
  • It runs TC again,
  • /O tells it to not open another window, but use the last active one.
  • /S /R= specifies the path to be set in the inactive panel.
  • "F:%%~pe": %%~p uses the path name (without drive information) of the given path from TC, which is stored in variable "e"

Code: Select all

for %%e in ("%P") do 
This is normally used for loops, here it is needed to separate drive and path from the path name given by TC ("%%~pe" above).


More Infos can be found by typing "FOR /?" at the command line (cmd.exe).
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
sujanlal
Junior Member
Junior Member
Posts: 26
Joined: 2007-12-08, 08:57 UTC

Post by *sujanlal »

Now it should also work with paths containing spaces.
Thanks. This is what i looking for.

I wish TC will have internal command for doing this in next release.
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post by *StatusQuo »

Info: A bugfix-update to version 2.02 of TCStartWithCommand is available,
the download link can be found in the original thread.
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
Post Reply