2
1
The topic explains it -- basically I have a bash script used on a Linux system and a Windows system with Cygwin where the following command works perfectly:
cp --parents
However, running this same command on Mac in terminal gives the following error:
cp: illegal option -- -
usage: cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file target_file
cp [-R [-H | -L | -P]] [-fi | -n] [-apvX] source_file ... target_directory
I am using the command in this context copying a select list of files into an output directory and retaining their directory structure:
cp --parents foo/gen1.file foo/bar/gen2.file foo/gen3.bar bar/foo/bar.file ~/my-output/
What can I do to get the cp --parents
behavior?
If you are copying the whole directory structure from foo/ on down, then
rsync -av foo ~/my-output/
would work for you. You can choose specific files with filter rules; but, that is starting to veer away from your original question. – Kent – 2013-12-06T05:50:13.223