Compress contents of folder using parent folder as zip name
Compress contents of folder using parent folder as zip name
- Subject: Compress contents of folder using parent folder as zip name
- From: Jenni via AppleScript-Users <email@hidden>
- Date: Fri, 17 Sep 2021 18:10:55 -0700
I’m trying to write an AppleScript that will
1] go into a selected folder in the Finder
2] select everything inside that folder (but not the enclosing folder itself)
and compress them into a single zip file
3] then name that zip file with the parent folder’s name
4] and finally save it in the parent folder.
I have the following which gets close to what I’m looking for, but it
also includes every folder above the selected folder, which I don’t want. I
only want the items in the selected folder to show in the zip file.
What do I need to change to make this work?
Thanks!
Marc
tell application "Finder"
set theItem to selection as alias
set itemPath to quoted form of POSIX path of theItem
set fileName to name of theItem
set theFolder to POSIX path of (container of theItem as alias)
set zipFile to quoted form of (theFolder & fileName & ".zip")
do shell script "zip -r " & zipFile & " " & itemPath
end tell
_______________________________________________
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