Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: need to copy my music to an exteranl drive preservating folder files struture (Read 2167 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

need to copy my music to an exteranl drive preservating folder files struture

Hi
Need to copy lots of my music from diffrent drives and partition to an external drive preservating folder files struture
after giving a try to some tools like fastcopy , Multi Commander ,Double Commander and seeing drag and drop does not work ,and they copy only files without preservating folder and files struture , i have decided to use foobar

I have created a playlist with all the audio i want to copy ,included *.jpg covers ,album arts and foobar2000 1.6.16
I have read this topic here topic

the user BenB did suggest to use
Code: [Select]
$directory(%path%,2)\$directory(%path%,1)\%filename%
and he said
Quote
note that $directory(%path%,n) re-creates the directory structure using the current names of the folders. n is the folder level counting up from the file.

but some of my folders di  include several subfoders and other only 1
so i have thoung
Code: [Select]
$directory(%path%,2)\$directory(%path%,3)\%filename%

can you please help me and tell me what/which is the best code to use and be safe to copy all music?
and foobar2000 V2 64bit can gain this process?
thanks

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #1
See this topic...

'Output path', example -
Code: [Select]
D:\

'Output style and filename formatting' -
Code: [Select]
$replace($directory_path(%path%),$left(%path%,3),)\%filename%

Note the above will recreate the root folder(s) too (i.e 'M:\Music')

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #2
See this topic...

'Output path', example -
Code: [Select]
D:\

'Output style and filename formatting' -
Code: [Select]
$replace($directory_path(%path%),$left(%path%,3),)\%filename%

Note the above will recreate the root folder(s) too (i.e 'M:\Music')
Hi @anamorphic
Quote
Note the above will recreate the root folder(s) too (i.e 'M:\Music')
1)
is there a way to avoid to create the root folders(s) ?
2)
is there a way to send from foobar to another application for the copy fastcopy , total commander or xyplorer (file managers) ?
thanks appreciate it a lot

 

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #3
1) Add the root folder(s) to the $replace should work -

If music is in 'M:\Media\Music\' -

Code: [Select]
$replace($directory_path(%path%),$left(%path%,3)Media\Music\,)\%filename%

Which is basically identical to -

Code: [Select]
$replace($directory_path(%path%),M:\Media\Music\,)\%filename%

Check the preview to make sure everything looks right.

(This way makes the code specific to your folder structure of course)

2) No idea. In general a foo_run type component, but that would be a whole other complicated setup. It would probably be better to setup those programs to do the copying correctly in the first place (which surely they must be able to do? - You should maybe ask in the appropriate forums for those programs)

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #4
1) Add the root folder(s) to the $replace should work -

If music is in 'M:\Media\Music\' -

Code: [Select]
$replace($directory_path(%path%),$left(%path%,3)Media\Music\,)\%filename%

Which is basically identical to -

Code: [Select]
$replace($directory_path(%path%),M:\Media\Music\,)\%filename%

Check the preview to make sure everything looks right.

(This way makes the code specific to your folder structure of course)

2) No idea. In general a foo_run type component, but that would be a whole other complicated setup. It would probably be better to setup those programs to do the copying correctly in the first place (which surely they must be able to do? - You should maybe ask in the appropriate forums for those programs)
hi anamorphic
my music is on several drives and partitions
Code: [Select]
$replace($directory_path(%path%),$left(%path%,3)Media\Music\,)\%filename%
and
Code: [Select]
$replace($directory_path(%path%),M:\Media\Music\,)\%filename%
are very similar ,they add partion letter like  add the drive letter with a minus for example A: -> A-
thanks appreciate your help

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #5
No idea how that could be happening.

Can you take a screenshot of the File Operations window / preview?

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #6
The ":" after drive letter always becomes "-", so it is easier to either strip the first two characters anyway, or alternatively: move the entire directory out of "A-" manually afterwards.

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #7
Ok I see, trying to do multiple drives at once. What if you $replace the drive letter, and then any root folders separately -

Code: [Select]
$replace($directory_path(%path%),$left(%path%,3),,Music\,,Media\Music\,)\%filename%

Just add as many differently named root folders as you have, followed by two commas, like above, except for the last one with just one comma. (I cannot really test any of this right now)

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #8
^ Too late to edit. Scratch the above. Actually it might be safer to add the beginning of each drive/path complete. (Otherwise with the above, if you had an album folder ending in 'Music\' it would get replaced incorrectly)

So example -

Code: [Select]
$replace($directory_path(%path%),A:\Music\,,D:\Music\,,M:\Media\Music\,)\%filename%

(etc)

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #9
Ok I see, trying to do multiple drives at once. What if you $replace the drive letter, and then any root folders separately -

Code: [Select]
$replace($directory_path(%path%),$left(%path%,3),,Music\,,Media\Music\,)\%filename%

Just add as many differently named root folders as you have, followed by two commas, like above, except for the last one with just one comma. (I cannot really test any of this right now)
hi
seem the best!
 
Code: [Select]
$replace($directory_path(%path%),$left(%path%,3),,Music\,,Media\Music\,)\%filename%
cheers

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #10
No, use the code in reply #8 which is safer -

Code: [Select]
$replace($directory_path(%path%),A:\Music\,,D:\Music\,,M:\Media\Music\,)\%filename%

Add as many drives/folders as you have.

And tick the box to 'Copy entire source folder content' if you want to copy images in the album folders, etc.

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #11
No, use the code in reply #8 which is safer -

Code: [Select]
$replace($directory_path(%path%),A:\Music\,,D:\Music\,,M:\Media\Music\,)\%filename%

Add as many drives/folders as you have.

And tick the box to 'Copy entire source folder content' if you want to copy images in the album folders, etc.
hi anamorphic
this script does create inside the destination folder for example mymusic\J-(partition\film\
why is the #8 code more safe?
here a screenshot , some host don't work like imgbb (don't know why)
thanks , appreciate a lot your help

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #12
It does that because you have not added J:\ + root folder, to the code -

Code: [Select]
$replace($directory_path(%path%),A:\Music\,,D:\Music\,,J:\Music\,,M:\Media\Music\,)\%filename%

Like I said, add as many drives as you have, followed by two commas.

I do not know all your drives/folders so cannot give you exact code.

However, it could be safe to use the other one too, if all your album folders are named like that - ending in '[FLAC]' for example. It was just in case you had an album folder ending in 'Music\' - that word gets removed.

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #13
It does that because you have not added J:\ + root folder, to the code -

Code: [Select]
$replace($directory_path(%path%),A:\Music\,,D:\Music\,,J:\Music\,,M:\Media\Music\,)\%filename%

Like I said, add as many drives as you have, followed by two commas.

I do not know all your drives/folders so cannot give you exact code.

However, it could be safe to use the other one too, if all your album folders are named like that - ending in '[FLAC]' for example. It was just in case you had an album folder ending in 'Music\' - that word gets removed.
Hi anamorphic
I could add all the drive letters from a to z , they should cover all the letters available for windows , what do you to you think?
thanks again

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #14
Drive letters are easy. The problem is you wanted to remove any root folders as well. I do not know the name of these folders so cannot give exact code - I'm just assuming the root folder is named 'Music'.

How about this way -

Code: [Select]
$replace($directory_path(%path%),$left(%path%,2),,\Music\,,)\%filename%

$left(%path%,2),,   - this removes drive letters.
\Music\,,   - this removes folder named 'Music' (more exactly)

If you have other root folders, you can add to the code using that pattern. Like if you want to remove 'Film' folder, add -

\Film\,,

Code: [Select]
$replace($directory_path(%path%),$left(%path%,2),,\Music\,,\Film\,,)\%filename%

Just check the preview to see what happens.

(If this is no good, you'll just have to tell me the name of every drive + root folder you have. There is no easy code to do it automatically - it has to be specific to your folder structure)

Re: need to copy my music to an exteranl drive preservating folder files struture

Reply #15
Drive letters are easy. The problem is you wanted to remove any root folders as well. I do not know the name of these folders so cannot give exact code - I'm just assuming the root folder is named 'Music'.

How about this way -

Code: [Select]
$replace($directory_path(%path%),$left(%path%,2),,\Music\,,)\%filename%

$left(%path%,2),,   - this removes drive letters.
\Music\,,   - this removes folder named 'Music' (more exactly)

If you have other root folders, you can add to the code using that pattern. Like if you want to remove 'Film' folder, add -

\Film\,,

Code: [Select]
$replace($directory_path(%path%),$left(%path%,2),,\Music\,,\Film\,,)\%filename%

Just check the preview to see what happens.

(If this is no good, you'll just have to tell me the name of every drive + root folder you have. There is no easy code to do it automatically - it has to be specific to your folder structure)
Hi Anamorphic
well I have done but foobar2000 with this code does copy *.iso , pdf  and other file that are no audio file at all , :o  :o
I have tried all the code but same results ,is it normal ?
 but is there a way to update my playlist and avoid to overdrive the same file in the copy process?
thanks again , I really appreciate your help