• 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: Compress contents of folder using parent folder as zip name
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compress contents of folder using parent folder as zip name


  • Subject: Re: Compress contents of folder using parent folder as zip name
  • From: Jim Weisbin via AppleScript-Users <email@hidden>
  • Date: Sat, 18 Sep 2021 15:43:34 -0400

You might want to look into using the ditto command instead of zip. It's been
years but the last time I looked into this, if I am remembering correctly, zip
did not preserve certain Mac/Finder information:
ditto -c -k --sequesterRsrc --keepParent src_directory archive.zip
>
> On Fri, 17 Sep 2021 18:10:55 -0700  email@hidden <mailto:email@hidden> wrote:
> To: email@hidden
> Subject: Compress contents of folder using parent folder as zip name
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset="utf-8"
>
>       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
>
> *****************************************

Jim Weisbin | C.T.O. | Human | Post Human | 27 West 20th Street | Suite 801 |
New York, NY | 10011 |   (917) 375-2272 | 2046 Broadway | Santa Monica, CA |
90404 |

 _______________________________________________
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

  • Prev by Date: Re: Compress contents of folder using parent folder as zip name
  • Next by Date: Re: Text comparison no working
  • Previous by thread: Re: Compress contents of folder using parent folder as zip name
  • Index(es):
    • Date
    • Thread