Posted on 05-03-2019 07:24 AM
Hi Everyone,
Newbie Here
I'm trying to replace an existing config xml file in the applications folder.
I packaged the the new config file to add in the existing folder. I wrote a simple script to run before running the package to remove the existing xml file, but for some reason the exisiting file is not being removed
#!/bin/sh
cd /Applications/Adobe InCopy CC 2015/Plug-Ins/vjoon K4
rm -rf 'K4 Config.xml'
Am I doing this wrong? Thanks in advance!
Solved! Go to Solution.
Posted on 05-03-2019 07:32 AM
What's wrong is the spaces in the path that you're trying to cd
into aren't escaped. In the shell, spaces usually have to be escaped, or, the path has to be enclosed in double quote marks.
But taking a step back, you don't need to cd into the directory first. You can just specify the full path to the xml you want to delete and use that in the rm
command, like this
rm -rf "/Applications/Adobe InCopy CC 2015/Plug-Ins/vjoon K4/K4 Config.xml"
As long as you confirm the path is correct, that should be all you need in your script. Though you could drop a 2>/dev/null
at the end of that line, just in case the XML happens to not be present, so the script won't exit with an error.
Posted on 05-03-2019 07:32 AM
What's wrong is the spaces in the path that you're trying to cd
into aren't escaped. In the shell, spaces usually have to be escaped, or, the path has to be enclosed in double quote marks.
But taking a step back, you don't need to cd into the directory first. You can just specify the full path to the xml you want to delete and use that in the rm
command, like this
rm -rf "/Applications/Adobe InCopy CC 2015/Plug-Ins/vjoon K4/K4 Config.xml"
As long as you confirm the path is correct, that should be all you need in your script. Though you could drop a 2>/dev/null
at the end of that line, just in case the XML happens to not be present, so the script won't exit with an error.
Posted on 05-03-2019 08:03 AM
@mm2270 Ok thanks I'll try this.
Posted on 05-03-2019 08:05 AM
This worked! Thank you!