• 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
Do shell script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Do shell script


  • Subject: Do shell script
  • From: Richard Rönnbäck <email@hidden>
  • Date: Wed, 15 Oct 2003 07:38:27 +0200

Hello,

I have been noticing some very interesting threads recently about finding
files with the help of Shell Script. I have been trying that myself, but
unfortunately I run into trouble when the filename contains special
characters, such as brackets, spaces etc. and since I have *very* limited
knowledge of Unix encodings and search strings I don't know how to deal with
that. Does anyone know of a way to handle this?


This works:

set myFolder to alias (((path to current user folder) as string) &
"Documents") -- in the actual script, the user chooses a folder
set myFolder to quoted form of (POSIX path of myFolder)
set myFolder to text 1 thru -3 of myFolder & "'" --drop final "/"
set myFileName to "AnythingGoes.txt" as Unicode text
set myFoundFiles to every paragraph of (do shell script "find " & myFolder
& " -name " & myFileName & " -type f")


This doesn't

set myFolder to alias (((path to current user folder) as string) &
"Documents") -- in the actual script, the user chooses a folder
set myFolder to quoted form of (POSIX path of myFolder)
set myFolder to text 1 thru -3 of myFolder & "'" --drop final "/"
set myFileName to "AnythingGoes(Copy).txt" as Unicode text
set myFoundFiles to every paragraph of (do shell script "find " & myFolder
& " -name " & myFileName & " -type f")


Nor would this

set myFileName to "Anything Goes.txt" as Unicode text
_______________________________________________
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.

  • Follow-Ups:
    • Re: Do shell script
      • From: Andrew Oliver <email@hidden>
References: 
 >TextField to Command line (From: Ian Mcginley - Systems Support Engineer <email@hidden>)

  • Prev by Date: open file for overwriting
  • Next by Date: Re: open file for overwriting
  • Previous by thread: TextField to Command line
  • Next by thread: Re: Do shell script
  • Index(es):
    • Date
    • Thread