• 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: Problem with dot_underscore files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with dot_underscore files


  • Subject: Re: Problem with dot_underscore files
  • From: "Mark J. Reed" <email@hidden>
  • Date: Fri, 14 Oct 2005 20:54:01 -0400

On 10/14/05, Gnarlodious <email@hidden> wrote:
Do shell script "find -d " & someFolder & " -name \"\\.DS_Store\" -exec rm -f {} \\; ;find -d " & someFolder & " -name \"\\._*\" -exec rm -f {} \\;;find -d " & someFolder & " -name \"\\.FBCLockFolder\" -exec rm -fR {} \\;;find -d " & someFolder & " -name \"\\.FBCIndex\" -exec rm -f {} \\;")

This script removes all Mac
specific files from the folder you select. There is probably a shorter command for this, if anyone knows how to wildcard the target files post it here.

The find command has an "or" option (-o), so you can do it all at once.  It's also more efficient to have the find command print the files out and then pipe its output to xargs rm to remove them, since one rm command can remove many files, not just one.  This should do the trick:

set filesToRemove to {".DS_Store", "._*", ".FBCLockFolder", ".FBCIndex"}
set shellCommand to "find " & (quoted form of startFolder) & " \\( "
set firstTime to true
repeat with targetFile in filesToRemove
     if firstTime then
         set firstTime to false
     else
          set shellCommand to shellCommand & " -o "
    end
    set shellCommand to shellCommand & " -name " & (quoted form of targetFile)
end
set shellCommand to shellCommand & " \\) -print0 | xargs -0 rm -f"
do shell script shellCommand

--
Mark J. Reed <email@hidden>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Problem with dot_underscore files (From: "John Jones" <email@hidden>)
 >Re: Problem with dot_underscore files (From: Gnarlodious <email@hidden>)

  • Prev by Date: Re: Problem with dot_underscore files
  • Next by Date: Re: Perhaps OT: how to make a custom CD that opens upon insertion to a window with custom background and icons
  • Previous by thread: Re: Problem with dot_underscore files
  • Next by thread: Re: Problem with dot_underscore files
  • Index(es):
    • Date
    • Thread