[Samba] linux -> windows special characters in filenames problems

John Drescher drescherjm at gmail.com
Tue Apr 28 18:21:01 GMT 2009


On Tue, Apr 28, 2009 at 1:17 PM, Kaleb Harper <kaleb.tmp at gmail.com> wrote:
> I just tried 'mangled names = No', it made the directory names appear
> properly, but when I try to open the directory, I get an error message that
> it can't access the folder. So I assume the only other way is going to be to
> somehow remove/change the ' : '. Any suggestions on how to do this would be
> helpful. If it's doable inside of Samba, that's great, if not, I'm not
> opposed to putting some kind of shell script on a cron to just go thru and
> rename everything with bad characters, but I'm afraid I don't know how to do
> that either :)
>
>
>
> On Tue, Apr 28, 2009 at 12:08 PM, Evans, Bill <bevans at fhcrc.org> wrote:
>
>> Try setting this in the share section in smb.conf
>>
>> mangled names = No
>>
>>
>>
>> Bill Evans
>>
>>
>> -----Original Message-----
>> From: samba-bounces+bevans=fhcrc.org at lists.samba.org
>> [mailto:samba-bounces+bevans <samba-bounces%2Bbevans>=fhcrc.org@
>> lists.samba.org] On Behalf Of
>> Kaleb Harper
>> Sent: Tuesday, April 28, 2009 10:03 AM
>> To: samba at lists.samba.org
>> Subject: [Samba] linux -> windows special characters in filenames
>> problems
>>
>> I'm running Samba 3.32 on my linux server to share files with the
>> windows
>> computers on the network. My problem is that windows doesn't support
>> some
>> special characters in filenames, like ' : ', that linux has no problem
>> with.
>> So something (not sure if it's Samba or windows) is mangling
>> directory/file
>> names containing that character into 8.3 names, which makes it very
>> difficult to know from windows what's in the directories; I'm having to
>> open
>> each directory to see the contents, which is quite an annoyance. Here's
>> a
>> couple of examples of how it's mangling directory names:
>>
>>
>> 'this: is a test'    is getting turned into        'THUKO5~M'
>> 'this: is another test'        is getting turned into        'TPYQ1X~Y'
>>
>>
>> Since I suspect there's not an easy way to get windows to understand the
>> ' :
>> ' and various other characters that it probably doesn't understand
>> properly,
>> I was hoping there was a way to change the mangling to something more
>> readable. I don't care if it removes the ' : ' completely, or changes it
>> into some other character, I just want to be rid of the 8.3 names. I'm
>> hoping that it's something that can be done from Samba so I don't have
>> to
>> reconfigure several windows computers, but I'll do whatever it takes if
>> I
>> have to :)
>>
>> I appreciate any help you all can give me.
>> --
>> To unsubscribe from this list go to the following URL and read the
>> instructions:  https://lists.samba.org/mailman/options/samba
>>


This should remove the : out of your filenames. Try it on a test folder first:

find . -name '*:*' | while read file;
do
target=`echo "$file" | sed 's/://g'`;
echo "Renaming '$file' to '$target'";
mv "$file" "$target";
done;


BTW, I modified this from the following example

http://design.liberta.co.za/articles/how-to-remove-spaces-from-filenames-in-linuxunix/

-- 
John M. Drescher


More information about the samba mailing list