Re: replace / in filename with _
Re: replace / in filename with _
- Subject: Re: replace / in filename with _
- From: Andy Wylie <email@hidden>
- Date: Wed, 28 Nov 2001 15:17:35 +1300
on 28/11/01 2:17 PM, kim at email@hidden wrote:
>
Hi all,
>
>
I have about 5000 files contained in a whole bunch of nested folders and
>
I need to replace a '/' (slash) in their names with an underscore.
>
(typically the names are 88/1, 2/87, and I need them to be 88_1, 2_87)
>
>
Does anyone have some code snippets that might help with this rather than
>
me having to start from scratch?
>
>
TIA
>
I'd do it like this using Tanaka's and Akua Sweets OSAX...
-----------
set aliasList to MT List Files (choose folder) name contains "/" return as
alias with sub folders
repeat with i in aliasList
try
set nixName to (munge ((basic info for i)'s name) from "/" to "_")
collate i by renaming it to nixName
on error m number n
error {n, nixName, m}
end try
end repeat
_____________________________ Andy