Posted on 04-26-2022 06:50 AM
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.
Solved! Go to Solution.
Posted on 04-26-2022 12:32 PM
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
Posted on 05-03-2022 07:42 AM
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
04-26-2022 11:51 AM - edited 04-26-2022 11:51 AM
have you tried single quote ( ' ) instead of the quote ( " )?
Posted on 04-26-2022 12:32 PM
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
Posted on 04-26-2022 05:56 PM
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
04-27-2022 07:59 AM - edited 04-27-2022 08:03 AM
if there are spaces in a path, you will have to "escape" them like in the second example from Corey_Nachkash. This should work
Posted on 05-03-2022 07:42 AM
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