Re: Problem with dot_underscore files
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