Renaming Invalid filenames

Status
Not open for further replies.

tazsta

Cadet
Joined
May 27, 2013
Messages
2
Hi guys,

I have done a bit of searching around for a solution to this problem but can't seem to find any that work for freenas.

Basically we had a old OS X server running as a file server and i have build a new server running the latest freenas. I managed to copy all the files across using rsync but now in the freenas shares (CIFS) there are some files and folders showing up called things like TP5CAV~P which is not what they are meant to be called. I have renamed a few files and folders manually now but there is way too many for me to do all manually. As i said before i found ways to rename invalid filenames in linux but not freenas. I'm fairly noob in freeBSD.

Any ideas would be greatly appreciated.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
The only idea I have is to delete the offending files/folders and recopy them using something besides rsync.
 

tazsta

Cadet
Joined
May 27, 2013
Messages
2
The only problem with that is that we have been using the new freenas server for about a month now so there would be a lot of modified and new files on the server now :(

Also i did try copying the data across using other methods but was going to take days, by then there would be too many changes to some of the files.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,525
I found that I had this problem when migrating from Server 2008 R2 to FreeNAS with rsync. The only solution I had was to get rid of rsync and copied the files manually using CIFS.
 

Caesar

Contributor
Joined
Feb 22, 2013
Messages
114
Do you still have access to the source file name? This maybe over your head but if you understand the logic behind the way rsync shortens long names then you should be able to use this to get a list of the original names

Code:
ls -R -m1 > list.txt

This will give you a list of original file names without the path
Then you can download this free windows app call File renamer basic and use the same logic to create a list of the shorten names and then use these two list to build a script to batch rename your files.

This will not be a simple task and you should test your script on a few files before trying it on your entire system. Also it would hurt to make sure you backup was up to date before trying something like this.
 

themac

Cadet
Joined
May 30, 2016
Messages
5
As mentioned here, this problem is coming from rsync, which preserves filename encoding and freenas using a different UTF-8 than Mac OS.
There are three different options listed in the article which solve this problem.

I know that you use cifs, but the reason should be the same.
 
Status
Not open for further replies.
Top