Having problems with files that have the ':' character
Mike Fedyk
mfedyk at matchmail.com
Tue Apr 17 02:10:03 GMT 2001
On Mon, Apr 16, 2001 at 08:49:38PM +0100, M?rio Gamito wrote:
> Hi!
>
> > Some of the files on my linux box have the character ':' in their name.
> > Viewing them over the network via smb, samba seems to replace the ':' with
> > a '~'.
> I having that very same problem.
> I run a network of abot 100 computers, half win98 half Macs.
> Well it seems that Macs in particular cause that problem and when it comes to
> share documents between computers using a common share, somtimes it's a mess.
>
> Since it seems there is no remedy to recover from the character ':' is there
> a way to prevent Samba to use it?
>
When converting from Macs I had to convert the 3 char code that netatalk
uses to encode "/" into ":fd" or something into "-" with a script.
Windows also has trouble with files ending with spaces, though I didn't make
a script that fixed that...
I'm trying different mangling options that may help....
Oh, crap. Samba 2.0.7 doesn't have any options that let you replace
characters in the middle of a name with something else...
You'll have to rename the files like I did, sorry.
I've attached the two scripts that I used, and commented them with a little
explanation. Use them with caution, I may have made an error, though I used
them myself... :)
Mike
-------------- next part --------------
#!/bin/sh
# This script calls the script fix_mac_file_codes on all files it finds
# the code for "/" created by netatalk.
#. ~/bin/fix_mac_file_codes
#set -x
count=1
while [ true ]; do
find -maxdepth $count -iname "*:2f*" -exec fix_mac_file_codes "{}" ";"
[ -z "`find -mindepth $count -maxdepth $(( $count + 1 ))`" ] && break
count=$(( $count + 1 ))
done
-------------- next part --------------
#!/bin/sh
#This script will replace codes used in netatalk to deal with "/" and "*" or
# the like in filenames. It is meant to be called from find with -exec
# the script ren_mac_file_codes does exactly that, and starts on parent directories
# first so that if a directory is renamed it will be followed with the new name
# after the move...
before="$@"
after="`echo $before|sed 's/:2f/-/g'|sed 's/*/-/g'`"
echo renaming $before to...
echo " $after"
mv "$before" "$after"
More information about the samba
mailing list