Subject: anyone have a script to change : to - in file and dir names?

From: Chris Harwell <[email-masked]>
Date: Wed, 13 Jun 2001 10:50:29 -0400 (EDT)

hi,

does anyone have a script which deals correctly with spaces etc in names,
works on the linux/unix side and changes colons in file names to a hyphen?
pesky things got there before i realized how useful the nohex option is.

thanks,

-- 
chris
[email-masked]

---

From: Danny Sauer <[email-masked]>
Date: Wed, 13 Jun 2001 10:08:18 -0500

> pesky things got there before i realized how useful the nohex option is.

for F in `find /path/to/files -name '*:*'`; do mv "$F" "`echo $F | sed 's/:/-/g'`"; done

I'm pretty sure that'll work if you're using a bourne shell (bash, for
example).  Maybe put an echo in before the mv the first time you run
it, so you can see if the command being executed looks right... :)  I
sure haven't tested it.

--Danny

---

From: Lee Sheridan <[email-masked]>
Date: Wed, 13 Jun 2001 11:30:55 -0400

> for F in `find /path/to/files -name '*:*'`; do mv "$F" "`echo $F | sed 's/:/-/g'`"; done

You may want to check out the "--backup" option in GNU mv since you want
to make sure you don't irreversably clobber an existing file.

Or if you're doing it interactively the "-i" option.

-- 
Lee Sheridan                            301.286.5898 voice
NASA / Goddard Space Flight Center      [email-masked]
Computer Sciences Corporation           Building 28, Room S241
Code 931
 
"Some people without brains do an awful lot of talking, don't they?"
                                           -- Scarecrow, The Wizard of Oz

---

From: Chris Harwell <[email-masked]>
Date: Wed, 13 Jun 2001 12:23:03 -0400 (EDT)

> > pesky things got there before i realized how useful the nohex option is.
hello,

1) i naively wrote the above question, actually asking for a script to
replace colons, what i really wanted was a script to find special
characters that included colons, like :2e, and :aa and replace them with
something else. though, i'm starting to think that's not such a good idea
anyway.

2)is there a FAQ somewhere that points out issues and and answers common
questions about code-pages and hex-codes - and problems encountered when
changing the code-page and nohex type options in
/etc/atalk/AppleVolumes.default?

if there is i'd really like to read it and find out what code-pages and
hex characters do and are - could someone point me in the right direction to find it?

3) here one for that FAQ:
situation:
a) created a netatalk volume without any of the codepage or nohex options
i.e.  in /etc/atalk/AppleVolumes.default stuck a line like this and restarted server:
/var/ftp/pub/mp3/collection "mp3 collection" allow:@mp3users,@mp3admin rolist:@mp3users

b) files and directories containing colons showed up on server, these colons in most cases
actually correspond to some special character like TM or space...

c) backed up file system over network through netatalk with above options using retrospect

d) changed options based on some email on netatalk-admins list to exclude hex and specified
a character set
i.e. in /etc/atalk/AppleVolumes.default stuck a line like this and restarted server:
/var/ftp/pub/mp3/collection "mp3 collection" allow:@mp3users,@mp3admin rolist:@mp3users codepage:maccode.iso8859-1 options:nohex

e) tried to back-up files and got lots of directory not found type of errors.
- those files or directories had special characters like :aa in their names

f) further examination showed some directories wouldn't display from a Mac.

Q: how to fix?
A: go back to the default codepage and allow hex codes.
codepage            hex
maccode.iso8859-1   no  - didn't work
maccode.iso8859-1   yes  - didn't work
none 		    yes  - worked

I'm assuming if I'd had the character set and nohex specified from the start that i would have had no problems.
Is this correct?

perhaps we could put a note in that AppleVolumes.default file like this:
codepage:filename   -> load filename from nls directory.
			N.B. changing this option may cause files written in the previous character set
			to not appear on the Mac side and might create directory not found errors.

what items should be taken into account in order to make a list of recommended codepage and hex/nohex options?
1) underlying file system, ext2 ....
2) native language
3) other ways file system may be written to a) samba b) ftp c) scp

thanks,

-- 
chris
[email-masked]