How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

English support forum

Moderators: white, Hacker, petermad, Stefan2

oko
Senior Member
Senior Member
Posts: 201
Joined: 2007-05-03, 16:22 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *oko »

sa16 wrote: 2024-02-10, 17:27 UTC 2oko
It does not work.
And what's wrong? Are files not copied?
Maybe you have set copy in background as default, then it works to you, but if not set so, copy in foreground makes unable next commands to take effect. As Fla$her says there should be /B1 or /B2 parameter added to cm_Copy to run copy in background so next commands take effect. Also after copy command there have to be delay to create folder to correctly run next commands.
Your solution works in this form:

Code: Select all

em_CopyTarget%B, cm_Wait 20, cm_FocusTrg, em_cd%BT

[em_CopyTarget%B]
cmd=cm_Copy
param=/G /B1 /T="%T%B\"
[em_cd%BT]
cmd=cd
param=%BT
I have deleted cm_ClearAll since it is maybe unnecessary. Or is there any reason to use that ?
sa16
Senior Member
Senior Member
Posts: 217
Joined: 2021-09-10, 07:15 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *sa16 »

2oko
Maybe you have set copy in background as default
My commands chain worked with a clean ini file.
Your solution works in this form:
Great!
I have deleted cm_ClearAll since it is maybe unnecessary. Or is there any reason to use that ?
Of course not. I just don't like to leave a selection on the panel.
oko
Senior Member
Senior Member
Posts: 201
Joined: 2007-05-03, 16:22 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *oko »

Code: Select all

[em_MKDirTarget]
cmd=%COMSPEC% /c mkdir
param="%T%B\"
I found out something wrong with mkdir if the parent directory contains spaces (e.g. "dir abc", the created folder is devided into more folders ("dir" and "abc"). Is there a solution for that?
User avatar
Wilhelm M.
Power Member
Power Member
Posts: 994
Joined: 2003-06-05, 10:45 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *Wilhelm M. »

Perhaps param=""%T%B\""? Doubled quotation marks.
At least mkdir "dir abc" (with quotation marks) makes a directory named "dir abc" on my system.
Grüße/Regards,
Wilhelm
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *Fla$her »

sa16 wrote: 2024-02-11, 13:04 UTC I just don't like to leave a selection on the panel.
Here the question is not about someone's wishes, but about what TC does by default, as I wrote above.

2oko
Are you saying that such a button has problems with spaces?

Code: Select all

TOTALCMD#BAR#DATA
%ComSpec% /q/c md
"%T%B"
wcmicons.dll,29


1
I don't observe anything like that. Provide the version and bit depth of TC.
Last edited by Fla$her on 2024-02-12, 13:15 UTC, edited 1 time in total.
Overquoting is evil! 👎
User avatar
Wilhelm M.
Power Member
Power Member
Posts: 994
Joined: 2003-06-05, 10:45 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *Wilhelm M. »

No, thats not what I meant. I simply answered to okos remark that mkdir produces two directories instead of one.This is the case if I use "mkdir dir abc" (without the quot. marks). So I thought adding additional marks would solve that problem: "mkdir "dir abc"" (without the outer marks).
Grüße/Regards,
Wilhelm
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *Fla$her »

2Wilhelm M.
Sorry, changed the nickname.
Overquoting is evil! 👎
sa16
Senior Member
Senior Member
Posts: 217
Joined: 2021-09-10, 07:15 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *sa16 »

Fla$her wrote: 2024-02-12, 12:30 UTC
sa16 wrote: 2024-02-11, 13:04 UTC I just don't like to leave a selection on the panel.
Here the question is not about someone's wishes, but about what TC does by default, as I wrote above.
TC removes the selection as you copy (AlwaysCopyInBackground = 0), provided that the cursor remains in the same panel. In my button, the cursor goes to another panel. Therefore, I used cm_ClearAll.
oko
Senior Member
Senior Member
Posts: 201
Joined: 2007-05-03, 16:22 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *oko »

2Wilhelm M.
Thanks. ""%T%B\"" works.

2Fla$her
As a button it works but if you have the same command in em command, it does not work, you must add one more quot.marks.

2Fla$her
What does the /q/c after %comspec% mean?
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *Fla$her »

sa16 wrote: 2024-02-12, 13:52 UTC TC removes the selection as you copy (AlwaysCopyInBackground = 0), ... Therefore, I used cm_ClearAll.
It's clear, but in the case of /B1 this is not required.

2oko
To avoid difficulties in creating custom commands, it's better to use the proper dialog (cm_CommandBrowser > usercmd.ini > [New...]), there is no need to enter any additional quotation marks, TC will do it for you if necessary.
Remove the backslash, it's not needed.

> What does the /q/c after %comspec% mean?
Run cmd and execute 'cmd /?|findstr/brc:/[QC]'.
Overquoting is evil! 👎
sa16
Senior Member
Senior Member
Posts: 217
Joined: 2021-09-10, 07:15 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *sa16 »

oko wrote: 2024-02-10, 08:57 UTC
sa16 wrote: 2024-02-08, 18:20 UTC 2oko

Code: Select all

em_CopyTarget%B, cm_ClearAll, cm_FocusTrg, em_cd%BT
It does not work. Because copying lasts some time and next commands are executed immediatelly. Maybe solution would be create and go to new target dir first and copy after all.
What specific problems do you have with the chain?
oko
Senior Member
Senior Member
Posts: 201
Joined: 2007-05-03, 16:22 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *oko »

sa16 wrote: 2024-02-12, 15:37 UTC What specific problems do you have with the chain?
Everything was said and explained already and problems are solved so far. I can repeat: While copy, the next commands in your chain do not take effect becase they do not wait until copy ends. So files are copied but nothing more is done after it. Therefore background copy is needed instead of foreground. I do not know how it works to you (even with clear ini). If you have selected files reamained in files window after or during copy, it could mean that not all files were copied and it works not to you too.
Last edited by oko on 2024-02-12, 16:10 UTC, edited 1 time in total.
oko
Senior Member
Senior Member
Posts: 201
Joined: 2007-05-03, 16:22 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *oko »

Thanks Fla$her for useful points.
sa16
Senior Member
Senior Member
Posts: 217
Joined: 2021-09-10, 07:15 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *sa16 »

2oko
So files are copied but nothing more is done after it.
As a result, the cursor does not go to a folder in another panel?
Are not all files being copied?
oko
Senior Member
Senior Member
Posts: 201
Joined: 2007-05-03, 16:22 UTC

Re: How to easy copy selected files to oposite side into subfolder with the same name as source parent folder?

Post by *oko »

2sa16
If we still talk about your original code: No, another panel is not focused. Files are copied all. Simply, only first command is runing, the other as they would not be there (cm_ClearAll, cm_FocusTrg, em_cd%BT).
Post Reply