IPB

Welcome Guest ( Log In | Register )

> foobar2000 Tech Support Forum Rules

Please read foobar2000 Tech Support Forum Rules before posting and comply with all the points.
Failure to provide all the information pointed out in the above document in your post is considered wasting other people's time and in extreme cases will lead to your topic getting locked without a reply.


See also: Hydrogenaudio Terms of Service.

 
Reply to this topicStart new topic
Foobar2000 and long folder/file name handling, error when copy, move or rename
John Doe
post Nov 15 2013, 20:16
Post #1





Group: Members
Posts: 233
Joined: 6-January 04
Member No.: 11006



Hi all,

I have a problem with the Windows limitation in path length while renaming my files with Foobar after tagging it. Unfortunately Foobar doesn't cut filename length when it is too long so it wont get copied/moved/renamed which is terrible for an automated process.

Scenario:
- Tag a classical album like "Leonard Bernstein - The Symphony Edition" with MusicBrainz
- Sample output is something like this (with my personal settings which are: %album artist% - (%date) - %album%\%tracknumber% - %title%) > I already shortened the %album% by hand and left out the %artist% in the file name but that wasn't enough:
CODE
Leonard Bernstein - (2010) - The Symphony Edition - CD 58 (Peter Ilyich Tchaikovsky: Symphony No.3 & 4)\06 - Symphony No.4 In F Minor, Op.36: I. Andante Sostenuto, Moderato Con Anima, Moderato Assai, Quasi Andante, Allegro Con Anima, Allegro Vivo

- some files like these will not get copied/renamed/moved due to 255 path length limitation and you will get an error.

How do you guys get around this problem without manually editing all file names (In this case 60 CDs!)?


My workaround described here by creating column that shows the overall path length:
CODE
$len(%album artist% - '('%date%')' - %album% %tracknumber% - %title%)

and than modifed only the ones that were to long. But thats really a pain.

Request: Foobar2000 should autmatically shorten file names ending with "..." (and show a warning of course)
Go to the top of the page
+Quote Post
BenB
post Nov 15 2013, 23:49
Post #2





Group: Members
Posts: 626
Joined: 17-April 12
Member No.: 98921



You could enter something like this in the "File name pattern" box:
QUOTE
$ifgreater($len(enter entire path of destination folder here\%album artist% - '('%date%')' - %album%\%tracknumber% - %title%),250,$cut(%album artist% - '('%date%')' - %album%\%tracknumber% - %title%,specify a number here that also takes the length of the path of your destination folder into account),%album artist% - '('%date%')' - %album%\%tracknumber% - %title%)

Make sure you carefully scrutinize the contents of the preview pane if you use this as it hasn't been tested..

Consult the title formatting reference for other options.
Go to the top of the page
+Quote Post
SigHunter
post Nov 16 2013, 00:21
Post #3





Group: Members
Posts: 40
Joined: 22-September 08
Member No.: 58544



my whole "move" script is
$if(%album%,$ifgreater($len(%album%),80,$abbr(%album%),%album%)$if(%band%, - $abbr(%band%))$if(%conductor%, - $abbr(%conductor%))$if(%split%, - $abbr(%split%))$if(%reissue%, %reissue%))\$if(%tracknumber%,$if(%discnumber%,CD $num(%discnumber%,2) - %tracknumber% - $abbr(%title%),%tracknumber%),%title%)

i use $abbr() alot. %album% gets shortened if it is longer than 80 characters, %band% and %conductor% gets always abbreviated, same goes for the tracktitles.

result looks following:
\Pjotr Iljitsch Tschaikowski\Symphonie Nr. 4 In F-moll - VP - HVK\CD 01 - 01 - AS-MCA-MAQAAV.flac
(Vienna Philharmonic, Herbert von Karajan, Andante Sostenuto - Moderato Con Anima - Moderato Assai, Quasi Andante- Allegro Vivo)

i really don't care alot about files/folders as long as they are able to correctly seperate two releases, tags are what matter.


Go to the top of the page
+Quote Post
John Doe
post Nov 18 2013, 12:19
Post #4





Group: Members
Posts: 233
Joined: 6-January 04
Member No.: 11006



Thank you guys. I Think the Abbreviaton script is a bit to much for me because I'd like the file names to be humanly readable, because I use different systems all the time or bring my music to a friend...

But in my opinion the foobar software should take care of a problem like that if it occures without me having to write a script.

I'll try the scripts above but other ideas are more than welcome.
Go to the top of the page
+Quote Post
marc2003
post Nov 18 2013, 14:52
Post #5





Group: Members
Posts: 4326
Joined: 27-January 05
From: England
Member No.: 19379



QUOTE (John Doe @ Nov 18 2013, 11:19) *
But in my opinion the foobar software should take care of a problem like that if it occures without me having to write a script.


that's not likely. foobar generally only ever does what you explicitly tell it to.

using the $cut function BenB mentioned would be the way to. here is how i'd approach it:

presumably a full readable folder structure is more important than the filename? have you checked to see what the longest possible folder name could be? using the method you mentioned above for determining file length, you could do something similar, adding the base folder in as well....

CODE
$len(D:\music\%album artist% - '('%date%')' - %album%)


subtracting the highest value from 255 will give a worst case scenario on what your shortest filename could be.

if it's acceptable, you could use a script something like....

CODE
%album artist% - '('%date%')' - %album%\$cut(%tracknumber% - %title%,$sub(243,$len(%album artist% - '('%date%')' - %album%)))


i've actually used 243 in my example to take into account the base folder name length and file extension. you may need to tweak it a little for your setup.

This post has been edited by marc2003: Nov 18 2013, 14:55
Go to the top of the page
+Quote Post
n99
post Nov 18 2013, 22:02
Post #6





Group: Members
Posts: 20
Joined: 15-May 11
Member No.: 90669



I don't know if it will help you, but when you've got trouble with long filenames you can use UNC:

\\?\C:\Folder\Subfolder\File.mp3
Go to the top of the page
+Quote Post
SigHunter
post Nov 18 2013, 22:09
Post #7





Group: Members
Posts: 40
Joined: 22-September 08
Member No.: 58544



QUOTE (n99 @ Nov 18 2013, 23:02) *
I don't know if it will help you, but when you've got trouble with long filenames you can use UNC:

\\?\C:\Folder\Subfolder\File.mp3


does that hurt performance?
can foobar have the media library as UNC path?
Go to the top of the page
+Quote Post
John Doe
post Nov 19 2013, 17:22
Post #8





Group: Members
Posts: 233
Joined: 6-January 04
Member No.: 11006



could you please explain UNC and how to use it? I didn't even understand the wikipedia article... :/
Go to the top of the page
+Quote Post
SigHunter
post Nov 19 2013, 20:52
Post #9





Group: Members
Posts: 40
Joined: 22-September 08
Member No.: 58544



QUOTE (John Doe @ Nov 19 2013, 18:22) *
could you please explain UNC and how to use it? I didn't even understand the wikipedia article... :/

UNC is mostly used for windows SMB networking, like \\computer\networkshare
but you can also access directories on your local machine, its just a different way to read/write the files then.
while the normal way is through the windows API, which has this 255 charcter limit, going through UNC doesn't have this limitation.
(keep in mind: not the filesystem has this limitation, its the API which foobar (and pretty much everything else) uses to read/write the files)

i don't know how foobar supports those local UNC paths though.
just did some fiddling around, when i added \\?\C:\Music\ in media library, it always displayed as C:\Music\, so no notable change.
adding \\sighunter\c$\Music however worked fine, but i don't know if that is run through SMB and therefore a performance impact happens
Go to the top of the page
+Quote Post
kode54
post Nov 20 2013, 04:18
Post #10





Group: Admin
Posts: 4499
Joined: 15-December 02
Member No.: 4082



\\?\ is used automatically.
Go to the top of the page
+Quote Post
John Doe
post Nov 20 2013, 14:23
Post #11





Group: Members
Posts: 233
Joined: 6-January 04
Member No.: 11006



OK I give up.
I still don't know how to "use" UNC. I just read it starts with \\?\ but I don't understand how to "activate" the usage of UNC, I don't know if it's compatible with everything else on Windows and so on...
...and what is \\sighunter\?
Go to the top of the page
+Quote Post
SigHunter
post Nov 20 2013, 14:40
Post #12





Group: Members
Posts: 40
Joined: 22-September 08
Member No.: 58544



QUOTE (John Doe @ Nov 20 2013, 15:23) *
...and what is \\sighunter\?

my name and an example of a windows networkshare assuming the computername is "sighunter", to state my case. \\windowscomputer\shareddirectory would work too ofcourse
Go to the top of the page
+Quote Post
foosion
post Nov 20 2013, 15:27
Post #13





Group: FB2K Moderator (Donating)
Posts: 4336
Joined: 24-February 03
Member No.: 5153



As kode54 said, foobar2000 will automatically use the \\?\ prefix which tells the operating system to handle the path differently. Most importantly, the entire path is no longer restricted to 259 characters (including the drive letter) but may be up to 32000 (+something) characters long. A single path component - i.e. the file name or a directory name - may be up to 255 characters long. Within these limits foobar2000 (and the operating system) are able to handle file paths. Usually you are not so lucky with other applications which may refuse certain operations on a file if the path length exceeds 259 characters. Even stranger, the same operations may work sometimes and sometimes not depending on whether the application uses a relative or absolute path to the file. The last time I experimented with longer than usual file names, even Windows Explorer did not handle UNC path. IIRC it would refuse to rename a file but had no problems moving the containing directory.

Bottom line: UNC path allow the use of longer file names but be prepared that some applications might not be able to handle them.


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
aliceten
post Nov 27 2013, 05:57
Post #14





Group: Members
Posts: 1
Joined: 27-November 13
Member No.: 112618



For such issues, use LongPathTool, it works good!
Go to the top of the page
+Quote Post
John Doe
post Dec 3 2013, 18:02
Post #15





Group: Members
Posts: 233
Joined: 6-January 04
Member No.: 11006



I don't think UNC is a good solution. I don't want to mess up my files for any other app/software... stupid Windows. wink.gif

I'll go with shortening instead. Thanks for helping. I still think it is a task, Foobar should perform automatically or at least optionally. But I'm not complaining about this great piece of software.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 19th April 2014 - 02:57