Copy single file(s) into multiple directories

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
steyrs
Junior Member
Junior Member
Posts: 17
Joined: 2011-03-03, 12:41 UTC

Copy single file(s) into multiple directories

Post by *steyrs »

Hello fellow Total Commander users.

I used Total Commander to extract a bunch of playlist files from my folders with music.
(I searched the files - feed to listbox - and then moved the playlist files to a seperate directory)

Now I would like to copy these playlist files (one by one) back to the directories.
Is that possible?
User avatar
Stefan2
Power Member
Power Member
Posts: 4153
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

Do you have any association for "this file" into "that directory"?

- - -

If not you can use TreeCopyPlus next time:

(search for the files - feed to listbox - use packer plugin TreeCopyPlus then to move the playlist files to a separate directory, keeping the folder structure)


How-to:

Suchen (Search)
Anwenden (Feed to listbox)
Strg+A (Ctrl+A)
Alt+F5
Packer (o)=>[TreeCopyPlus] +++ [konfigurieren] ([Configure] (how many path level?) [OK])
[OK]


- - -
TreeCopyPlus 1.051
(c) Alexander Golikov aka SUKER
----------------
Packer plugin for Total Commander.
It's intended for copying/moving files with keeping of full folder tree (see examples below).
see www.totalcmd.net
or http://www.ghisler.com/plugins.htm



 
User avatar
steyrs
Junior Member
Junior Member
Posts: 17
Joined: 2011-03-03, 12:41 UTC

Post by *steyrs »

Stefan2 wrote:Do you have any association for "this file" into "that directory"?
 
Hi Stefan2 - not sure what you have in mind.

There is no file association as such.
I just would like to copy back my *.m3u files to the directories where they came from.
I am aware of the option to "copy to all selected folders" - but that would copy all the playlist files - to all the directories that I choose - and that is not what I want..

Maybe I will have a go with TreeCopyPlus - and see if it solves my problem
Personal License: 109213
User avatar
Stefan2
Power Member
Power Member
Posts: 4153
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

steyrs wrote:
There is no file association as such.
I just would like to copy back my *.m3u files to the directories where they came from.
Yes, but how should one know which file belongs to which folder?

That's why I ask for a relationship.... perhaps by the name of m3u files and folders?
(copy ABBA.m3u to X:\Music\Albums\ABBA)



If not, you have to take a list of that relationship,...
f.ex. with TreeCopyPlus (and best with some further steps...)



or create a list of *.m3u files from your original folder:
- open DOS-Box
- cd to your main music folder
- switch to PowerShell
- create a list with this PoSh command:
GCI -rec *.m3u |ForEach{$A=Split-Path $_.FullName -Leaf; "COPY ""$A"" ""$_"" " } |select -first 5 |Out-file "myList.CMD.txt"


- open that "myList.CMD.txt" and see if it makes sense.
(COPY "ABBA.m3u" "X:\Music\Albums\ABBA\ABBA.m3u")

(Or change the PoSh command to get
COPY "ABBA.m3u" "X:\Music\Albums\ABBA\ABBA.m3u MOD.m3u"
just by using: "COPY ""$A"" ""$_ MOD.m3u"" " in the PoSh comamnd)




- copy that "myList.CMD.txt" to your "separate directory" as "myList.CMD"

If you execute it, it will copy each OriginName.m3u to the right folder.

But only if you have no files or folders with same name?


It's not easy to help with so minimal info and no examples provided. All what I say might by wrong for your situation.



 
 
User avatar
steyrs
Junior Member
Junior Member
Posts: 17
Joined: 2011-03-03, 12:41 UTC

Post by *steyrs »

Hi Stefan2.

First of all - don't get me wrong!
I really appreciate you - trying to help me.

I have posted an image here - to clarify what I'm trying to accomplish.

https://postimg.org/image/ygx66t4rl/

So yes - there is an relationship - between file name and foldername.

Does it make sense now - if not - don't hesitate to ask.
Personal License: 109213
Olfert
Junior Member
Junior Member
Posts: 61
Joined: 2006-05-17, 10:55 UTC

Post by *Olfert »

Wonder if you could simply pack the files to a zip-file in the first place maintaining the file/folder structure?
User avatar
Stefan2
Power Member
Power Member
Posts: 4153
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Post by *Stefan2 »

steyrs wrote: I have posted an image here - to clarify what I'm trying to accomplish.
Thanks, but still no full path, so we can provide only a more common help:

For example

FROM:
c:\Temp\ToCmd\A\Artist One.m3u
c:\Temp\ToCmd\A\Artist Three.m3u
c:\Temp\ToCmd\A\Artist Two.m3u

TO:
c:\Temp\ToCmd\B\Artist One\Artist One.m3u
c:\Temp\ToCmd\B\Artist Three\Artist Three.m3u
c:\Temp\ToCmd\B\Artist Two\Artist Two.m3u

- open DOS-Box
- change to "c:\Temp\ToCmd\A" with the *.m3u files
- execute
FOR /F "tokens=*" %X in ('dir /B') DO @COPY "%X" "c:\Temp\ToCmd\B\%~nX\%X"


That command does:
- for each m3u file in "c:\Temp\ToCmd\A"
- take only the base name w/o extension (\%~nX\) as the wanted folder name
- and copy the m34 to the folder with same base name

Of course adjust the paths to yours.

And execute in DOS-Box the "copy /?"-command to see the help of the copy command
and take care of the "/Y" switch for overwriting existing files.


Make sense?
 
Last edited by Stefan2 on 2017-11-14, 13:08 UTC, edited 1 time in total.
User avatar
steyrs
Junior Member
Junior Member
Posts: 17
Joined: 2011-03-03, 12:41 UTC

Post by *steyrs »

Olfert wrote:Wonder if you could simply pack the files to a zip-file in the first place maintaining the file/folder structure?
Perhaps - too late for that now though ;)
Personal License: 109213
User avatar
Hacker
Moderator
Moderator
Posts: 13061
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

steyrs,
In case you had the log turned on one could determine the original paths and hack together a short script to copy the files back.

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
steyrs
Junior Member
Junior Member
Posts: 17
Joined: 2011-03-03, 12:41 UTC

Post by *steyrs »

Stefan2 wrote:
For example

FROM:
c:\Temp\ToCmd\A\Artist One.m3u
c:\Temp\ToCmd\A\Artist Three.m3u
c:\Temp\ToCmd\A\Artist Two.m3u

TO:
c:\Temp\ToCmd\B\Artist One\Artist One.m3u
c:\Temp\ToCmd\B\Artist Three\Artist Three.m3u
c:\Temp\ToCmd\B\Artist Two\Artist Two.m3u

- open DOS-Box
- change to "c:\Temp\ToCmd\A" with the *.m3u files
- execute
FOR /F "tokens=*" %X in ('dir /B') DO @COPY "%X" "c:\Temp\ToCmd\B\%~nX\%X"


That command does:
- for each m3u file in "c:\Temp\ToCmd\A"
- take only the base name w/o extension (\%~nX\) as the wanted folder name
- and copy the m3u to the folder with same base name

Of course adjust the paths to yours.

And execute in DOS-Box the "copy /?"-command to see the help of the copy command
and take care of the "/Y" switch for overwriting existing files.


Make sense?
 
Hi Stefan2!

Yes it made sense!
And it works like a charm - you are a genius ;-)
Thx a bunch!
Personal License: 109213
User avatar
steyrs
Junior Member
Junior Member
Posts: 17
Joined: 2011-03-03, 12:41 UTC

Post by *steyrs »

Hacker wrote:steyrs,
In case you had the log turned on one could determine the original paths and hack together a short script to copy the files back.

Roman
Hey Roman.

I don't have logging turned on - but thx for pointing that out ;)
Personal License: 109213
Post Reply