cp --parents option on mac
Solution 1:
This bothered me quite a lot as well. A workaround for this could be to use rsync.
rsync -R test/withintest/go.rb test2
has the same effect as cp --parents
and OS X comes standard with rsync.
Solution 2:
You can use the ditto
command on Mac OS X:
The basic form
ditto <src-path> <dst-path>
does what you want. There's a lot more options too - check out the man page.
Solution 3:
You can install the GNU version of cp
using MacPorts.
After MacPorts is installed you can install the coreutils packages:
sudo port install coreutils
Then you will be able to use the GNU version cp
and other core utilitites (ls
, date
, cat
, etc.) by prefixing the command with a g
:
gcp --parents test/withintest/go.rb test2
If you want these GNU versions to be used by default you can add the GNU bin update your path. Add the following to your ~/.bash_profile
:
export PATH="/opt/local/libexec/gnubin:$PATH"