Re: Need to rename files/folders - zsh shell
Re: Need to rename files/folders - zsh shell
- Subject: Re: Need to rename files/folders - zsh shell
- From: "John C. Welch" <email@hidden>
- Date: Thu, 10 Jun 2004 14:27:49 -0500
On 6/10/04 12:07 PM, "Gnarlodious" <email@hidden> wrote:
>
> The Mac users will access their data via smb mounts. The issue is that
>
> our Mac users have characters in their file names that are not allowed
>
> on a windows server.
>
Windows does not allow these characters in filenames:
>
? [ ] / = + < > ; : " , - *
>
>
athough I hear cygwin has no problem with them.
>
>
> Anyone have any ideas?
>
A shell script is definitely called for here.
>
>
(found on Google)
>
>
zsh:
>
autoload -U zmv
>
chars='[][?=+<>;",*-]'
>
zmv '(**/)(*)' '$1${2//$~chars/%}'
>
>
Anyone know how to plug this into Applescript?
Actually, I've a script that I did years ago, designed to handle this very
situation. It's not as fast as that shell script, but there's some
intelligence in it, in that it does look for file types, if they are there,
and makes the extension match it, or creates the extension if need be.
Two caveats:
1) It truncates to 31characters including the extension. That's pretty easy
to fix, and would actually speed it up. I can do it, or you can if you like.
2) It's not been looked at beyond a recompile and a reasave as a carbon
applet. So it's real unoptimized. It's also real old, but pretty vanilla
AppleScript.
3) It doesn't do folders. (When I wrote it, I didn't know how ;-). Again,
fixable, I've just not had a reason to. You're welcome to do so if you like.
You can get it at: <
http://www.bynkii.com/applescript/scripts/osx_scripts/
MakeWindowsNamescarbon.sitx>, it's reasonably well commented. Use it, modify
it with my blessings.
john
--
Yeah, I know Sid Vicious wore a lock on a chain around his neck just like
that. But the first time you try and pogo with that thing on it9s gonna chip
a tooth, Road Warrior.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.