Re: replace / in filename with _
Re: replace / in filename with _
- Subject: Re: replace / in filename with _
- From: Michelle Steiner <email@hidden>
- Date: Tue, 27 Nov 2001 18:32:43 -0700
On 11/27/01 6:17 PM, kim <email@hidden> wrote:
>
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)
Here's a bit of code to convert the text.
--Michelle
set foo to {"88/1", "2/87"}
set tid to text item delimiters
repeat with counter from 1 to count of foo
set text item delimiters to {"/"}
set bar to item counter of foo
set bar to text items of bar
set text item delimiters to {"_"}
set item counter of foo to bar as text
end repeat
set text item delimiters to tid
foo
--> {"88_1", "2_87"}
----------------------------------------------------------------------
| Michelle Steiner | We're not human beings having a spiritual |
| | experience. We're spiritual beings |
| email@hidden | having a human experience. |
----------------------------------------------------------------------