[Logo] Jaikoz and SongKong Forums
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Issue with File names being too long, Rename mask?  XML
Forum Index -> Jaikoz Questions
Author Message
seth.feinberg

Pro

Joined: 17/12/2011 20:48:04
Messages: 42
Offline

First the obligatory praise for this wonderful program and Paul for being so attentive to the users' issues. Thanks again for what feels like the millionth time. Now the issue :

I store all my music on a Synology NAS (built on Linux I believe). All of the music I had been editing for the last few weeks resided on a partition ON the NAS called "Temp". I finished neatening up the files to my taste and moved the finished folder to the "Music" partition (on the same NAS). After the transfer (I was using Win7 to access the mapped drives, so it was really a Copy/Paste) i got 46 error's about the file being too long for the destination. I thought this weird. The files, which are admittedly very long (DAMN YOU RUSH/DAVID BOWIE!), were all named and saved just fine when I finished with Jaikoz. And i can view them just fine in Explorer and the Synology web interface/mobile app. Also the destination they were edited IN is extremely nested (the files are roughly 4 levels from the "Temp" root) and being moved to a "Finished" folder of the "Music" partition's root. Anyhoo, I just found this weird and thought maybe I was missing something elementary and maybe its a quick fix.

So anyways, the best way for me to deal with this given my current understanding of the problem is to add a .substring to the title and/or artist/albumartist being used in the "File Renaming Mask" and I suppose possibly the "Folder Renaming Mask". My issues are that I really don't understand what in this scenario is the limit of the file name (I don't understand this wiki page http://en.wikipedia.org/wiki/Comparison_of_file_systems). I can only assume that the limits are inclusive of the folder structure, but don't understand why it named fine originally but I just can't move it between drives on my NAS. I guess what I'm asking (after babbling for an hour :oops is if there is something I can do with Javascript that I can conditionally limit the length of the destination file and what is that Limit?

edit: actually i just realized that perhaps it has something to do with the fact I was using Win7 to do the transfer, though even if this is the issue I'd probably still want to conditionally limit the length of the file name. Any suggestions would be greatly appreciated.
greengeek

Pro
[Avatar]

Joined: 18/09/2007 02:50:48
Messages: 435
Offline

Windows has a bunch of annoying limitations in the file system. There are quite a few different characters that are not allowed in the file names as well as certain combinations of characters. As far as length goes, one is limited to a total of 260 characters. This includes all characters, including spaces, and all the folders in the file path.

Sometimes you can get files that were named on a mac or in linux and that are near impossible to edit in windows as they have an invalid file name structure. This can be a real pain to have to edit through DOS.

I like to stream a lot of my music online through my own website, so I prep my files to be as file system friendly as possible to play nicely with my win home server NAS as well as php code friendly for my website and flash/html5 player.

I bought this program a long time back to run my files through after I tag and rename them to verify there are no problems with length or characters or breaking any windows file structure rules. It is a commercial program, and the UI is horrible, but it does a wonderful job at identifying any issue. It also allows one to edit files that windows won't allow direct editing access to. It is called DelInvFile and can be found here: http://www.purgeie.com/delinv/


KevinBluemel.com
Contemporary Instrumental Musician and Composer. Stop by to listen, watch videos, and get free downloads of songs and sheet music.
[WWW]
seth.feinberg

Pro

Joined: 17/12/2011 20:48:04
Messages: 42
Offline

Thanks @greengeek! Very useful information and I will def check that DelInvFile out. I embarassingly made a mistake in my previous post. It turns out that these 46 files were NOT being displayed in Explorer, just the Synology web interface and I WAS able to move them inside that web interface. I only got the error because I tried to copy over the higher up containing folder in Win7. Either way I'm very interested in adding something to the renaming masks to address this problem. I was thinking of adding to the File Renaming Mask something along the lines of this:

(title.length>0 && title.length<25 ? title : title.substring(0, 22) + '...')

and then perhaps add a similar thing to the album variable and to then similarly edit the Folder Renaming mask. But the limit of 25 I've chose is purely (and obviously) arbitrary. It would be optimal if I could put an "If" statement at the beginning of the mask to test the length of the overall filename and truncate the title/album only if the resulting file is beyond the limit that can be displayed by Windows (apparently 260). I realize this limit is inclusive of the overall folder path so probably a bit beyond the scope of Jaikoz but maybe it would be possible to specify some sort of warning inside Jaikoz when your resulting filename surpasses some user-defined length? Just a humble suggestion.

More practically: I'm a total noob when it comes to Javascript (and most things unfortunately) and was hoping someone on here could help me with a more elegant way of truncating my filenames than what I detailed in the above paragraph...
seth.feinberg

Pro

Joined: 17/12/2011 20:48:04
Messages: 42
Offline

Alright this is how I dealt with it so far:

I used this website (http://www.lettercount.com/) to get the count of my filenames (There may be a better way I'm sure). I read here (http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx) and noticed when I looked at the properties of an offending file that anything over 255 (not 260) would cause Windows problems. So then at Lettercount.com I loaded up the full file path from windows and deleted everything that wouldn't be a constant in the naming. For my mask this left me with this:

Code:
Y:\Music\\(2001)  - \ -  - 1-20 - 


255- (the sum of the above) gave me the max that I could use in the naming of a file, in my case 221, which I will refer to as PersonalMax from here on out.

Then in the File Renaming Mask I replaced

Code:
title


with:

Code:
(title.length>0 && (title.length+(2*album.length)+(artist.length)+(2*albumartist.length))<221 ? title : title.substring(0, ((title.length+(2*album.length)+(artist.length)+(2*albumartist.length))-225)) + '...')


I figured I'd really only want to fix the title since that is the offending aspect more often than not and because its at the end of the filename in my mask. I then added "..." at the end to let me know that the filename was truncated for Windows (subtracting [PersonalMax+3], which i find logical didn't work, so I used [PersonalMax+4] and it did). The string sums up all the aspects that would be used to create the filename and folder path (I will call this FileSum) and if FileSum is greater than PersonalMax, it uses a substring of title from 0 to (FileSum-PersonalMax+4) and appends a "..." at the end.

I tested this on a few files and it works. Unfortunatley there are rare instances in my renaming mask where I slightly fudge whether to use Artist or AlbumArtist in the file/folder names (eg Since I don't like having a Various Artists folder, I use this:Code:
(albumartist.length>0 && albumartist!='Various Artists'  ? albumartist + ' - ' :(artist.length>0 ? artist + ' - ' : ''))
for my Rename Mask and uncheck compilation when I want to sort a Various Artist Album by Artist). I might try to fix that later (its gonna create a heck of an IF statment) but I think it coming into play will be a rare occurrence.

Hope this maybe helps someone and I would love to hear thoughts if anybody has any.
 
Forum Index -> Jaikoz Questions
Go to:   
Powered by JForum 2.1.6 © JForum Team