Copy files (with rename) to other directory

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
CADDrone
Junior Member
Junior Member
Posts: 8
Joined: 2023-04-11, 19:09 UTC

Copy files (with rename) to other directory

Post by *CADDrone »

Apologies if this has been asked and answered. I did try to search a few phrases but came up empty (see below).

Q: Is there a Shortcut or Command to copy from one window to the other window and rename the file(s) in the process?

To elaborate:
1. I'm running a search for a specific File Name, in a folder with a LOT of sub-folders.
2. Within each sub-folder, each file has the exact same file name.
3. My search (say "AB123456AA") could result in a couple dozen files with the same name.
4. I "Feed to Listbox" the results.
5. When I go to copy those resulting files into a single folder (in the other window), I would like to rename each file to include something I can use to distinguish between the files. Often this is related to the name of the Sub-folder it came from.

So now, obviously, TotalCommander has the following shortcuts:
> Copy (to other window) = F5
> Copy files (with rename) in the same directory = Shift+F5 - which includes the option to "rename each file separately"

But what I want to do is:
> Copy files (with rename) to other directory = ???

Searches I tried here:
SHIFT+F5
"SHIFT+F5"
"Copy files (with rename)"
"Copy files (with rename) to other directory"

I also looked around the inet for Shortcuts that other people may have noted. And, I looked through the Command List in my TC version to see if there was anything that jumped out at me.
TC License Holder #103720
CADDrone
Fla$her
Power Member
Power Member
Posts: 2982
Joined: 2020-01-18, 04:03 UTC

Re: Copy files (with rename) to other directory

Post by *Fla$her »

[Options >>]
5. Auto-rename copied
☑ Copy to all selected folders/links in the target panel

Command: cm_Copy /AGB0O5RSV
Overquoting is evil! 👎
User avatar
CADDrone
Junior Member
Junior Member
Posts: 8
Joined: 2023-04-11, 19:09 UTC

Re: Copy files (with rename) to other directory

Post by *CADDrone »

Thanks Fla$her,
Three issues with that:
1. My "☐ Copy to all selected folders/links in the target panel" is Unchecked and Greyed out.
2. I don't want to "Auto-Rename" because it does not rename the files in a manner that helps me.
3. I don't need this every time I copy files, just when I do this one type of operation.

Sorry I don't know TC that well. Can I create a shortcut based on the command you provided?

I appreciate your help. 8)
Fla$her wrote: 2025-02-06, 16:07 UTC [Options >>]
5. Auto-rename copied
☑ Copy to all selected folders/links in the target panel

Command: cm_Copy /AGB0O5RSV
TC License Holder #103720
CADDrone
User avatar
CADDrone
Junior Member
Junior Member
Posts: 8
Joined: 2023-04-11, 19:09 UTC

Re: Copy files (with rename) to other directory

Post by *CADDrone »

Sorry if I wasn't clear. Maybe it would help if I included an image.

Image: https://www.dropbox.com/scl/fi/r8owega0b8rl0ce1kii5k/TC-Copy-Op.jpg?rlkey=n0y6w70cuyuyrqhis7fvop8n9&st=27dqxpba&dl=0

Left Window: Search Results from a long list of Sub-Folders. These are Purchase Orders to our Manufacturers.
Right Window: Empty Directory. This is a folder inside the Project all those Purchase Orders are for.

I want to copy all the files in the Search Results to the Empty Folder. But, because all the file names are identical, I need to add a suffix to each file so that I can see which Manufacturer the Purchase Order belongs to.

My current options are:
1. Use F5. I am able to copy and Auto-Rename, which I don't want.
2. Use Shift+F5. I get the functionality to add the suffix I want to each file. Problem with that is the files stay in their respective folders AND I don't see them in my search results. So I have to run the search again to get those files into the Search Results, before I can move the files to the Folder I want them in.

Both options are time consuming and more work than I think I should be doing, which is why I'm looking for a shortcut to "Copy files (with rename) to other directory".
TC License Holder #103720
CADDrone
RedTiF
Junior Member
Junior Member
Posts: 19
Joined: 2009-09-10, 11:03 UTC

Re: Copy files (with rename) to other directory

Post by *RedTiF »

Feed the list in MRT (MultiRenameTool) and for Rename Mask use [N]_[B+1]
Press in MRT F1 for Help

HTH

Remark: this move the files!
User avatar
CADDrone
Junior Member
Junior Member
Posts: 8
Joined: 2023-04-11, 19:09 UTC

Re: Copy files (with rename) to other directory

Post by *CADDrone »

8) Thanks for the suggestion, *RedTiF. It renames the file in such a way I can use it. However, I don't want to move the files, or rename the originals. I want to copy them over to the other window (Keep Original in Left, Copy in Right) and change the name of the new file. And I'd really like to be able to assign a Keyboard Shortcut to that operation.
TC License Holder #103720
CADDrone
Fla$her
Power Member
Power Member
Posts: 2982
Joined: 2020-01-18, 04:03 UTC

Re: Copy files (with rename) to other directory

Post by *Fla$her »

Code: Select all

TOTALCMD#BAR#DATA
%comspec% /q/c for %i in
("%S") do for %%d in ("%%~pi.") do echo f|>nul xcopy/chkqry %%i "%T%%~nxd_%%~nxi"
wcmicon2.dll,63
Copy files to the target panel with the parent dir name added in front

1
Last edited by Fla$her on 2025-02-06, 20:10 UTC, edited 1 time in total.
Overquoting is evil! 👎
User avatar
CADDrone
Junior Member
Junior Member
Posts: 8
Joined: 2023-04-11, 19:09 UTC

Re: Copy files (with rename) to other directory

Post by *CADDrone »

SOLVED: Sometimes it just takes a little talking through. :wink:

So, the issue I was having was in the Copy Dialog Box itself. What I realized after going through this a number of times is that I could just as easily change the "Copy 13 file(s) to" location from "*.*" to the folder location I want the files in.

I do appreciate y'alls help.

And thank you, Fla$her, I will also give that script a try.
TC License Holder #103720
CADDrone
User avatar
CADDrone
Junior Member
Junior Member
Posts: 8
Joined: 2023-04-11, 19:09 UTC

Re: Copy files (with rename) to other directory

Post by *CADDrone »

I appreciate this, Fla$her. It's close, but it seems to copy the same file each time it runs into a space.

The File Structure I'm looking for is along these lines. This is what the file name changed to in the MRT.
[N]_[B+1], where [N] is the Filename, [B+1] is the Folder it is coming from.
Ex: HC012725GP_C & S Plating.pdf

Per your code below, the file above is being renamed as (3):
C_HC012725GP.pdf
&_HC012725GP.pdf
S_HC012725GP.pdf
Last edited by CADDrone on 2025-02-06, 20:18 UTC, edited 1 time in total.
TC License Holder #103720
CADDrone
Fla$her
Power Member
Power Member
Posts: 2982
Joined: 2020-01-18, 04:03 UTC

Re: Copy files (with rename) to other directory

Post by *Fla$her »

Added quotation marks in parentheses.

I'm aware that this is my button code. Why quote it?
Overquoting is evil! 👎
User avatar
CADDrone
Junior Member
Junior Member
Posts: 8
Joined: 2023-04-11, 19:09 UTC

Re: Copy files (with rename) to other directory

Post by *CADDrone »

Habit, sorry. Still not working right. Nevermind, I'm obviously wasting your time. I'm good with the other solution I have. I appreciate your help.
TC License Holder #103720
CADDrone
Fla$her
Power Member
Power Member
Posts: 2982
Joined: 2020-01-18, 04:03 UTC

Re: Copy files (with rename) to other directory

Post by *Fla$her »

What's wrong? My result: "folder name_HC012725GP_C & S Plating.pdf"
Overquoting is evil! 👎
sa16
Senior Member
Senior Member
Posts: 324
Joined: 2021-09-10, 07:15 UTC

Re: Copy files (with rename) to other directory

Post by *sa16 »

2CADDrone
I don't want to move the files, or rename the originals
You can rename files in the MRT, copy them, and roll back (Undo) in the MRT to their previous names.
Post Reply