INTERACT FORUM

More => Old Versions => JRiver Media Center 18 for Windows => Topic started by: amargolis on March 07, 2013, 05:24:56 pm

Title: Move, Copy, Rename - Truncate filenames in case they're too long?
Post by: amargolis on March 07, 2013, 05:24:56 pm
I'm reorganizing the folder structure in my library and getting errors due to filename/path being too long on tracks with really long "names." I'm sending all my files to:

Z:\Music Library\Album [Disc #]\[Track#]. [Name]

Ideally the disc # would only be added on multi disc albums, but it won't really bother me that much to have a "1" at the end of each folder name if that's not possible.

Thanks!
Title: Re: Move, Copy, Rename - Truncate filenames in case they're too long?
Post by: MrC on March 07, 2013, 06:23:22 pm
How do you want the name truncated?  Just chop off the last portion at some character limit?

Use this to conditionally include [Disc #]:

Z:\Music Library\[Album]/##/IfElse(!IsEmpty([Disc #],1), / [Disc #])\[Track #]. [Name]
Title: Re: Move, Copy, Rename - Truncate filenames in case they're too long?
Post by: amargolis on March 07, 2013, 06:32:40 pm
To the rescue again, thanks man!

Yeah, fine to just truncate as you described, unless you know of a better way?

Is there any kind of glossary that could help me learn how you build these expressions? So I don't have to bug you all the time.  ;)
Title: Re: Move, Copy, Rename - Truncate filenames in case they're too long?
Post by: MrC on March 07, 2013, 06:50:42 pm
You're welcome.

You might want to create a view that tests the length of the entire path/filename, and perhaps modify those Names that are excessive.  You could use:

length(Z:\Music Library\[Album]/##/IfElse(!IsEmpty([Disc #],1), / [Disc #])\[Track #]. [Name])

as a pane column, and you'll see an ordered list of path lengths.

To fix your path, you might just truncate Name with Mid():

Z:\Music Library\[Album]/##/IfElse(!IsEmpty([Disc #],1), / [Disc #])\[Track #]. mid([Name],0,60)

where you change the 60 to the length you want.  You probably don't want to truncate before the path separator, as you might be chopping off a folder.

See the Expression Language (http://wiki.jriver.com/index.php/Media_Center_expression_language) wiki for the functions list and some examples.
Title: Re: Move, Copy, Rename - Truncate filenames in case they're too long?
Post by: amargolis on March 07, 2013, 07:33:49 pm
Good idea, i'll do that to shorten the super long ones. Thanks.

When I use the rule you gave me, (Z:\Music Library\[Album]/##/IfElse(!IsEmpty([Disc #],1), / [Disc #])\[Track #]. [Name]) to create the file path, it's still adding a "1" to the end of album name folders even on single disc albums. I can live with it, but if there's an easy fix, I'll take it!
Title: Re: Move, Copy, Rename - Truncate filenames in case they're too long?
Post by: MrC on March 07, 2013, 07:55:30 pm
It will only add Disc # it if there is a value in Disc #.  For your single-disc albums, clear the [Disc #] field.