Copy one file to many directories/subdirectories

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Rimdur
Junior Member
Junior Member
Posts: 9
Joined: 2005-06-03, 17:24 UTC
Location: Oslo - Norway

Copy one file to many directories/subdirectories

Post 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"
User avatar
Flint
Power Member
Power Member
Posts: 3511
Joined: 2003-10-27, 09:25 UTC
Location: Belgrade, Serbia
Contact:

Post by *Flint »

Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 11.03 / Win10 x64
StatusQuo
Power Member
Power Member
Posts: 1524
Joined: 2007-01-17, 21:36 UTC
Location: Germany

Post 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).
Who the hell is General Failure, and why is he reading my disk?
-- TC starter menu: Fast yet descriptive command access!
Rimdur
Junior Member
Junior Member
Posts: 9
Joined: 2005-06-03, 17:24 UTC
Location: Oslo - Norway

MultiCopy

Post by *Rimdur »

Thank's a lot. Very helpful.

How about implementing it in TC?
vo
Junior Member
Junior Member
Posts: 47
Joined: 2012-08-16, 01:28 UTC

Post 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
vo
Junior Member
Junior Member
Posts: 47
Joined: 2012-08-16, 01:28 UTC

Post 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
User avatar
HolgerK
Power Member
Power Member
Posts: 5412
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post 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
vo
Junior Member
Junior Member
Posts: 47
Joined: 2012-08-16, 01:28 UTC

Post by *vo »

Oh, I see, I see...

Thanks very much HolgerK!

vo
User avatar
white
Power Member
Power Member
Posts: 5988
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post 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?
User avatar
HolgerK
Power Member
Power Member
Posts: 5412
Joined: 2006-01-26, 22:15 UTC
Location: Europe, Aachen

Post 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
User avatar
white
Power Member
Power Member
Posts: 5988
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Post 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.
Post Reply