Re: Unzip multiple items Applescript-terminal syntax help!
Re: Unzip multiple items Applescript-terminal syntax help!
- Subject: Re: Unzip multiple items Applescript-terminal syntax help!
- From: Axel Luttgens <email@hidden>
- Date: Thu, 29 Oct 2009 14:50:15 +0100
Le 29 oct. 2009 à 13:56, Cerciello a écrit :
Smashing Axel
do shell script ("cd " & this_path & "; find . -exec unzip -o {} \
\;; rm -rf __MACOSX") works beautifully. One thing not really
important is that if I see in the terminal what going on I see this:
Pippos-MacBook-Pro:~ gc$ cd '/Users/gc/Desktop/untitled folder/';
find . -exec unzip -o {} \;; rm -rf __MACOSX
unzip: cannot find or open ., ..zip or ..ZIP.
Archive: ./.DS_Store
Yep: the Finder creates such hidden files as soon as one opens a
directory...
[...]
Unfortunately the 2nd suggestion: do shell script ("cd " & this_path
& "; unzip -o *.zip; rm -rf __MACOSX") doesn't work, the terminal
said:
[...]
Sorry, I always forget that "unzip file1 file2" doesn't mean the same
as "unzip file1; unzip file2". :-(
One would thus need to loop over the file list:
for F in *.zip; do unzip -o "$F"; done
(and take care to escape the quotes when making use of "do shell
script")
But then adding the name constraint to the "find" command doesn't
appear much more complicated:
find . -name '*.zip' -exec unzip -o {} \;
and could help to solve the above problem with non zip files.
Would also be possible to move to the trash the .zip files after
been unzipped?
A quick way would be to add those files to the already existing "rm"
command:
rm -rf __MACOSX *.zip
But this assumes that the "cd" command has been successful!
Summarizing:
do shell script ("cd '" & this_path & "' || exit 1; find . -name
'*.zip' -exec unzip -o {} \\;; rm -rf __MACOSX *.zip")
But please double-check...
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden