• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: replace / in filename with _
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Folder Actions in OS X
      • From: Gary Beberman <email@hidden>
  • Prev by Date: Re: replace / in filename with _
  • Next by Date: Re: replace / in filename with _
  • Previous by thread: Re: replace / in filename with _
  • Next by thread: Folder Actions in OS X
  • Index(es):
    • Date
    • Thread