Skip to main content
Solved

Script to unzip file to user Library


Forum|alt.badge.img+3

I'm trying to write a script to unzip a zip file from tmp to a user Library, the exact path is:

unzip /tmp/MicrosoftChartTemplates.zip -d /Users/USERNAME/Library/Group Containers/UBF8T346G9.Office/User Content/Chart Templates

The issue seems to be spaces, like for "Group Containers". From what I understand you need quotes, but that doesn't seem to work either. Once the file is in that folder I need to unzip it to that location. Any help would be much appreciated. Also, a DMG is not an option since we will be updating these files regularly and would like to only update the zip file and the not the entire package. This wasn't my decision, just what I have to work with.

Thanks to all who take the time to reply.

Best answer by Corey_Nechkash

I think you're missing some syntax. Some of these folders have a ".localized" that follows the folder name. 

This seemed to work for me:

unzip /tmp/MicrosoftChartTemplates.zip -d "/Users/USERNAME/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Chart Templates.localized/"

or you can do it without the quotes too:

unzip /tmp/MicrosoftChartTemplates.zip -d /Users/USERNAME/Library/Group\\ Containers/UBF8T346G9.Office/User\\ Content.localized/Chart\\ Templates.localized/

 

Hopefully that works for you,

Corey

View original
Did this topic help you find an answer to your question?

5 replies

Forum|alt.badge.img+10
  • Valued Contributor
  • 134 replies
  • April 26, 2022

have you tried single quote ( ' ) instead of the quote ( " )? 


Corey_Nechkash
Forum|alt.badge.img+12

I think you're missing some syntax. Some of these folders have a ".localized" that follows the folder name. 

This seemed to work for me:

unzip /tmp/MicrosoftChartTemplates.zip -d "/Users/USERNAME/Library/Group Containers/UBF8T346G9.Office/User Content.localized/Chart Templates.localized/"

or you can do it without the quotes too:

unzip /tmp/MicrosoftChartTemplates.zip -d /Users/USERNAME/Library/Group\\ Containers/UBF8T346G9.Office/User\\ Content.localized/Chart\\ Templates.localized/

 

Hopefully that works for you,

Corey


Forum|alt.badge.img+8

Perhaps installing them into the system would be better? Not sure if they'd work with charts but might be easier.

I install powerpoint and word templates to 

/Library/Application Support/Microsoft/Office365/User Content.localized/Templates.localized


  • 0 replies
  • April 27, 2022

if there are spaces in a path, you will have to "escape" them like in the second example from Corey_Nachkash. This should work


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 2 replies
  • May 3, 2022

Thank you to everyone who responded! @Corey_Nachkash your solution got me there, I appreciate the help! Here is the script for anyone who might need it.

#!/bin/sh

 

localUsers=$( dscl . list /Users UniqueID | awk '$2 >= 501 {print $1}' | grep -v admin )

 

for userName in "$localUsers"; do

unzip /tmp/MicrosoftChartTemplates.zip -d /Users/tcunningham/Library/Group\\ Containers/UBF8T346G9.Office/User\\ Content.localized/Chart\\ Templates.localized/

done

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings