Page 1 of 1

Copy one file to many directories/subdirectories

Posted: 2008-01-21, 22:40 UTC
by Rimdur
Hi, is it possible to have a feature that allows me to copy on file to many folders at once?
I have an audio book in 15 directories. I would like to copy one file into all of the directories in "one operation" To day I have to copy it 15 times to all the directories. PIA
In left pane I have picture.jpg that I would like to copy right pane, c:\audio\1\, and to c:\audio\2\, and so on.
Just add a feature to F5 that says "Copy file to all marked folders"

Posted: 2008-01-22, 15:28 UTC
by Flint

Posted: 2008-01-22, 21:40 UTC
by StatusQuo
2Rimdur
If you need to copy only 1 file at a time into these directories, you can simply use this Batch:

Code: Select all

@echo off
for /F "usebackq tokens=* delims=" %%e in (%2) do (copy "%~1" "%%~e")
pause
Save this as a text file named e.g. TC_Copy2MultiDirs.cmd.

You can use it as a button, in starter menu or as user-defined command, like this:

Code: Select all

Command   : X:\path\TC_Copy2MultiDirs.cmd
Parameters: "%T%M" %L
(with "X:\path" changed to where you saved the file)
Ready with setting up.


To use it, in TC
  • put the cursor onto the file you wish to copy, then
  • switch to the other panel and mark all directories, that you want to copy the file to
  • then just call the above command (button, menu - wherever you stored it)
and the file gets multi-copied for you.

The "pause" in the 3rd line is to let you have a look at the copy results (in case there was an error).

MultiCopy

Posted: 2008-01-28, 21:32 UTC
by Rimdur
Thank's a lot. Very helpful.

How about implementing it in TC?

Posted: 2012-10-30, 16:24 UTC
by vo
@ StatusQuo:

I see Rimdur understood what you meant and it worked for him. Unfortunatelly, it didn't for me :(

I'm probably not doing something right.

So, I opened the notepad and pasted the code you said above:

@echo off
for /F "usebackq tokens=* delims=" %%e in (%2) do (copy "%~1" "%%~e")
pause


save it as: TC_Copy2MultiDirs.cmd

I saved it in TC dir (even though I don't think that location matters, so ignore this info if redundant).

Then Start>Change start menu>

Under Command I locate the .cmd file (or write the path to the file with the file and the extension...same thing)

Under parameters I put "%T%M" %L

Should I put something under "Start path" field?

Then I click OK.

Next, (with right click) mark the file on the left side of TC; Then mark destination directories on the right side; Click anywhere in the left field; Start(menu)>Copy2MultiDirs (this is the title I assigned)

and nothing happens, there's only a blink of a window that appears and disappears in the same moment.

I followed you instructions a few times and tried something else, but that time after clicking Start>Copy2MultiDirs, Win explorer opened the folder where the .cmd file is saved.

Could you please tell me what I am doing wrong. First time doing this, btw.

...can this issue be to the fact I'm on company's comp?? not really...

Thank you.

vo

Posted: 2012-10-30, 16:27 UTC
by vo
Wow! Wait, now it worked! o_O ?

I stayed in the right field and it was fine now. Yesterday when I stayed in the right (destination) field it copied directories to the left instead of the file to the right...

If you know what could be the mistake, please let me know. If not - ignore this post :)

Thanks.

vo

Posted: 2012-10-30, 17:00 UTC
by HolgerK
2vo

This thread was from 2008!

Meanwhile these workarounds are no longer necessary.
History.txt wrote:10.11.10 Release Total Commander 7.56 beta 1
...
29.10.10 Added: F5 copy, option "Copy to all selected folders/links": When normal files are selected, copy to the directories of these files after search - feed to listbox (only if there is no target dir)
Regards
Holger

Posted: 2012-10-30, 17:11 UTC
by vo
Oh, I see, I see...

Thanks very much HolgerK!

vo

Posted: 2012-10-31, 00:17 UTC
by white
When normal files are selected, copy to the directories of these files after search - feed to listbox (only if there is no target dir)
What does that mean?

Posted: 2012-10-31, 07:25 UTC
by HolgerK
Maybe:
- You can search for a single filename
- feed the result to the listbox
- select them as target
- and overwrite these files at once with a newer version.

Regards
Holger

Posted: 2012-10-31, 11:58 UTC
by white
white wrote:
When normal files are selected, copy to the directories of these files after search - feed to listbox (only if there is no target dir)
What does that mean?
HolgerK wrote:Maybe:
- You can search for a single filename
- feed the result to the listbox
- select them as target
- and overwrite these files at once with a newer version.
Yes, it may mean something like this:
When files are selected in the target folder, all source files are copied to the folders of the target files. But only if the target windows contains a search results list. For instance, when using TC 7.55a and selecting a folder and a file in a normal target window, source files are only copied to selected the folder.

Then there was a fix for branch view:
(28.11.10) Fixed: F5 copy, option "Copy to all selected folders/links": In branch view, the file was only copied to subdirs, not to the base dir, even if a file was selected there
Now it does not matter whether or not the target window contains a folder listing or not. When selecting a folder and a file in a normal target window, source files are copied both to the selected folder and to the folder of the selected file. So it seems it no longer works as designed.