Skip to main content

Topic: Using FB2K for correcting file names that are too long ? (Read 1913 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • swayzak
  • [*][*][*]
Using FB2K for correcting file names that are too long ?
Hi

I came across a weird problem today.

I have been running a music library from an ext USB driver (320GB+, mostly mpt3 files) for my Logitech Squeezebox devices.

Bought a nice new Win 7 64bit laptop today with a 750GB drive so tried to copy over the library.

Annoyingly approx. 113 mp3 files refused to copy because of filename length issues.

Don't understand why they can exist & be played from the USB drive on my old netbook, but there you go.

Is there an easy way I can use FB2K to identify all the culprits & shorten the filename lengths to circumvent this problem ?


thanks

  • derty2
  • [*][*][*][*][*]
Using FB2K for correcting file names that are too long ?
Reply #1
Before commiting to a massive copy/backup job, it is wise to check if any files exceed the default path length limit.

For NTFS and FAT filesystems, the default Windows path length limit is around 255-259 characters.
For NTFS and FAT filesystems, the length of the name of a single file or directory component is limited to 255 characters

For NTFS filesystems only, the theoretical maximum path length limit is actually around 32767 characters; but the Windows built-in copy programs do not give you control of these features.
But, there are some third-party programs which can control these features, and can set the max path length while copying;
one such program is a command line copy tool named XXCOPY (freeware and sharewrae versions available).

Here is an example command line of using XXCOPY to perform such a task:
Code: [Select]
xxcopy "E:\source folder" "G:\destination folder" /MD /YY /E /K /R /H /U0 /FF /I /VL /oB3 /oS3 /oE3 /oP2 /oX2 /Fo"G:\destination folder\log_copied.txt" /oN"G:\destination folder\log.txt"

Explanation of each XXCOPY command-line switch:
/MD            Makes destination directory before all other actions
/YY             Suppresses all prompts unconditionally; yes to everything; do not stop and ask me anything.
/E               Processes directories and subdirectories, including empty ones.
/K               Keeps the source attributes
/R               Allows overwrite or delete of read-only files
/H               Copies hidden and system files
/U0             Updates all files; ignores whether the file exists or not in destination.
/FF              Fuzzy filetime matching; allow matches within +/- 2 second range
/I                If destination directory does not exist and copying more than one file, assumes that destination must be a directory (no prompting).
/VL              Sets the maximum path length to 32767 characters if destination is an NTFS filesystem
/oB3            Log Output -  Reports to screen and log file, brief command switch list
/oS3            Log Output -  Reports to screen and log file, skipped file list (with the reason why skipped)
/oE3            Log Output -  Reports to screen and log file, error summary with the system error code
/oP2            Log Output -  Reports to log file, detailed command switch list
/oX2            Log Output -  Reports to log file, excluded items list
/Fo<file>     Creates log file - listing of files which were successfully processed
/oN<file>     Creates log file - report of the job
 
 
 
Another way of managing this is to download a freeware tool named CutLongNames
Code: [Select]
http://www.replsoft.com/cutlongnames.html

It will search a specified folder (and all sub-folders) for files whose path length exceeds a specified amount of characters.
Once the list of found files is processed, you can cut them down to the specified size with one click; or manually edit each item in the list.

  • swayzak
  • [*][*][*]
Using FB2K for correcting file names that are too long ?
Reply #2
Many thanks

Is there a simpler method in FB2K e.g. a column code for listing music files in order of filename length ?

That would make it relatively simple to track down the 100 or so culprits which I can then rename in FB2K to shorten filename length.
  • Last Edit: 18 April, 2012, 06:43:42 AM by Frank Bicking

  • derty2
  • [*][*][*][*][*]
Using FB2K for correcting file names that are too long ?
Reply #3
Yes it is possible to manage this information from within foobar2000.

Firstly, I would like to state that I am using Columns UI alternative user interface ("CUI"), and this allows me to create a custom column with conditional string colors,
i.e. if path is below 255 characters in length then display the string using normal color, if string exceeds 255 characters display the string in bright red.
As you may guess, having the option of coloring strings conditionally is a powerful visual aid, unfortunately the foobar2000 Default User interface ("DUI") does not have such features.

So... this is how to do it :

Create a custom column in your Playlist Viewer,

         and give it a name, eg: Path Len.

         and give it dimensions, eg: Width: 59 | Alignment: Centre

         and give it this Display script: $len(%path%)

Restart foobar2000 (to permanently set this new configuration).

Search your entire Media Library and create a custom playlist,

         @ foobar2000 toolbar -> Library -> Search

         @ Media Library Search window -> enter this query:  ALL SORT DESCENDING BY "$len(%path%)"

         wait for list to fully populate...

         click button [...] -> Create Playlist

         close Media Library Search window

You now have a Playlist of your entire Media Library sorted by Path Length, descending with highest number at the top of the list (as can be seen in your Path Len. column).

Happy editing.
 
 
 
P.S. --- was there a need to quote my whole previous post !!!???

  • swayzak
  • [*][*][*]
Using FB2K for correcting file names that are too long ?
Reply #4
Many thanks

However this sorts by path length (rather than file length) doesn't it ?

Therefore by this method I may miss some overlong file names as their actual path length may disguise the true filename size ?
  • Last Edit: 18 April, 2012, 08:43:22 AM by Frank Bicking

  • derty2
  • [*][*][*][*][*]
Using FB2K for correcting file names that are too long ?
Reply #5
Why do you care about the length of this argument? : $len(%filename_ext%)

You have a problem with copying items whose path length exceeds 255 characters.
The 'path length' includes the full path to the file.

E:\My Music\Rock\Sungrazer\(2011) Mirador\Sea.flac
this item has a length of 50 characters, and you get the info using this argument: $len(%path%)

Sea.flac
this item has a length of 8 characters, and you get the info using this argument: $len(%filename_ext%)

Why do you care about the number of characters in the music file?
It is irrelevant; you want to know about the length of the full path to the music file (which includes the music file itself).


P.S. -- Why do you enjoy fully quoting previous posts !!??
  • Last Edit: 18 April, 2012, 09:16:24 AM by derty2

  • swayzak
  • [*][*][*]
Using FB2K for correcting file names that are too long ?
Reply #6
Sorry - just being dim I guess.

I thought my issue was with the filename length specifically, rather than the path length.