Skip to main content

Topic: Is it possible to automatically rename a folder? (Read 3787 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • comox
  • [*]
Is it possible to automatically rename a folder?
Hello,

what I wish for is a function to rename a folder (that contains an Album, Compilation, EP...) by its tag (group column). E.g. if I I have an album in my playlist that's correctly displayed as "Michael Jackson - Thriller" in the group column, but the folder is named as "surgery accident", it shall be possible to rename it by the group column.

Is there any possibility?

Greetings.
  • Last Edit: 13 May, 2009, 02:29:39 AM by comox

Is it possible to automatically rename a folder?
Reply #1
As far as I know the only way to do that within foobar would be using:
right klick -> file operations -> move to...
There you can setup the destination folder the way you want using %artist% - %album% (and you can rename the files to in the same go if you need to).
Check "move entire source folder content" if your sure everything in the folder belongs there  and "remove empty source folder".

Once you have that setup right I would advise to save the setup as a preset. That way next time you need it will be included in the context menu.
(right klick -> file operations -> move to... -> preset)

But a simple "rename folder to..." would actually be nice.
"nudge nudge wink wink devs say no more say no more"
 


  • d'Wooluf
  • [*]
Is it possible to automatically rename a folder?
Reply #2
The problem is that there is no concept of relative addresses within Foobar file operations (my understanding anyway). So yes, you can rename the parent folder but you have to supply the path to that folder. If there were a token that you could use in the rename string for <current directory> or <parent directory>, you could make a preset for changing the name of the parent folder that would work anywhere within your file structure. There's probably a reason why such a thing was not included. It would be interesting to know the reason.
  • Last Edit: 13 May, 2009, 04:31:19 AM by d'Wooluf

  • Yirkha
  • [*][*][*][*][*]
  • Moderator
Is it possible to automatically rename a folder?
Reply #3
If there were a token that you could use in the rename string for <current directory>...
%path% = "C:\Music\Artist\Album\Track.mp3", $directory_path(%path%) = "C:\Music\Artist\Album\"
...or <parent directory>, ...
%path% = "C:\Music\Artist\Album\Track.mp3", $substr(%path%,0,$strrchr($substr(%path%,0,$sub($strrchr(%path%,\),1)),\)) = "C:\Music\Artist\"
Full-quoting makes you scroll past the same junk over and over.

  • Nemphael
  • [*][*][*]
Is it possible to automatically rename a folder?
Reply #4
...or <parent directory>, ...
%path% = "C:\Music\Artist\Album\Track.mp3", $substr(%path%,0,$strrchr($substr(%path%,0,$sub($strrchr(%path%,\),1)),\)) = "C:\Music\Artist\"

$replace(%path%,$directory(%path%,1)\%filename_ext%,)

Is it possible to automatically rename a folder?
Reply #5
I have been fiddeling around a bit with %path% in the "file operations...".
For some reasone it doesn't result in for example "C:\Music\Artist\". I end up with something like "C-\Music\Artist\" which makes it rather useless.
Anyone else getting this result?

  • Nemphael
  • [*][*][*]
Is it possible to automatically rename a folder?
Reply #6
You have to enter two queries: Destination Folder is the folder you want to put your music in (Say, C:\Music), then you can use a File Name Pattern: %artist% - %album%.
  • Last Edit: 13 May, 2009, 07:26:30 AM by Nemphael

Is it possible to automatically rename a folder?
Reply #7
I am aware of that
What I was trying to get was a way to make a preset "that would work anywhere within your file structure." as d'Wooluf said it so fitting.
But it seems that title formatting cant be used in the first query for the destination folder.
I tried to use $cut(%path%,3) which should leave just the "C:\" from what I understand.
But I get an "invalid/nonexistent target folder" in the preview.

EDIT: btw... sorry to the OP for somewhat hijacking the thread
  • Last Edit: 13 May, 2009, 07:44:35 AM by FuzzyLogic

  • Yirkha
  • [*][*][*][*][*]
  • Moderator
Is it possible to automatically rename a folder?
Reply #8
Only like this:

Destination folder: C:\
File Name Pattern: $substr(--whatever-custom-formatting-from-%path%--,3,999)
  • Last Edit: 13 May, 2009, 08:09:21 AM by Yirkha
Full-quoting makes you scroll past the same junk over and over.

  • hlloyge
  • [*][*][*][*][*]
Is it possible to automatically rename a folder?
Reply #9
I don't get this. If I do what you proposed
$substr(--%album artist% - %album%[ '['%date%']']/%tracknumber% - %title%--%path%,3,999)

I get complete nonsense.

When using just
$substr(%path%,3,999)

I get the current path. But I want to add a date at the end of a folder in [1987] format. How do I do that?

now I have

Yazoo - Only Yazoo (The Best Of)
I want
Yazoo - Only Yazoo (The Best Of) [1999]

...and to work in current folder. Where to put [ '['%date%']']?

How?

  • Yirkha
  • [*][*][*][*][*]
  • Moderator
Is it possible to automatically rename a folder?
Reply #10
I meant the whole [font= "Courier New"]--whatever-custom-formatting-from-%path%--[/font] as to be replaced.

Anyway, exactly for what you want to do:
[font= "Courier New"]$substr(%path%,3,$sub($strrchr(%path%,\),1))' ['%date%']'\%filename%[/font]

[font= "Courier New"]$substr(%path%,3,$sub($strrchr(%path%,\),1))[/font] -- Get the part from from the 4th char (skip the C:\ prefix) to the last \ (at the end of the last directory name).
[font= "Courier New"]' ['%date%']'\%filename%[/font] -- Append the date in brackets, then use the original filenames in the folder.
  • Last Edit: 21 May, 2009, 10:47:48 AM by Yirkha
Full-quoting makes you scroll past the same junk over and over.

  • hlloyge
  • [*][*][*][*][*]
Is it possible to automatically rename a folder?
Reply #11
Yirkha, thank you, it works as intended.
I just don't understand this scripting, thank you for helping.

  • mll
  • [*]
Is it possible to automatically rename a folder?
Reply #12
Only like this:

Destination folder: C:\


Hi, I'm resurrecting this very old - and interesting - thread to ask if, as of today, your workaround is still necessary, or if "Destination folder" can be scripted to guess the drive where the files are.

In my case, music can be on C: or on N:, and I'd like to move my files
from
Code: [Select]
[Drive]:\[original path]\[original filename].mp3

to
Code: [Select]
[Same drive]:\$directory_path(%path%)\%album%\$num(%discnumber%,2).%tracknumber%-%totaltracks% %artist% - %title%