Where the contents of A (latest files in Audio drive) are being merged with B (older files in Sample Beast drive) as so:
cp -r <source folder> <target folder>
When I do this, the whole of the the <source folder> is copied into the <target folder> instead of merging the contents of both and if I try to select one folder down from the <target folder> (which has the same name as the source folder), then I get this error:
<source folder> and <target folder> are identical (not copied).
Imported from the Apple Support Forums via the Wayback Machine 🔗
I would very much like to have an answer to this question as well. Right now the best solution that I can think of is to use diff and patch, but I'm not sure if it will work on binary files as well. There's a guide on using diff and patch [here|http://stephenjungels.com/jungels.net/articles/diff-patch-ten-minutes.htm l].
0
Mark Jalbert·
Imported from the Apple Support Forums via the Wayback Machine 🔗
cp -R <source folder>/ <target folder>
When you add "/" after the source folder then the contents of the source folder will be copied to the target folder. rsync is a better tool.
Message was edited by: Mark Jalbert
0
onesizeup·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Hi Mark,
Would I be right in thinking I would do this?
rsync -r <source folder>/* <target folder>
As well as copy across new files, I want to replace older files in the target folder using this command.
Thanks for your help,
osu
0
Tony T1·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I want to replace older files in the target folder using this command.
As suggested, use rsync. The man page will give you examples
0
Mark Jalbert·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Would I be right in thinking I would do this?
rsync -r <source folder>/* <target folder>
Well, that's the sledgehammer approach. The following command will update the directory "091023 Archived Logic projects" on /Volumes/Sample Beast S with any changes made in the directory "091023 Archived Logic projects" on /Volumes/Audio.
Making a guess here based on the -r I used earlier.
Is there a good place to start learning the command line from scratch as a total beginner? I 'm told it has so much potential, so I'd like to learn it properly.
0
Tony T1·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Is there a good place to start learning the command line from scratch as a total beginner?
Imported from the Apple Support Forums via the Wayback Machine 🔗
You don't have to use the -r option with -a. From the rsync man page:
-a, --archive archive mode; same as -rlptgoD (no -H)
The archive mode should work recursively. Also be careful using the -E option because in the newer version of rsync it preserves executability. If you are using this command in some script then you'll have to update the script whenever Apple updates rsync (or you compile it yourself).
As for learning to do things on the CLI, you can also start learning on the CLI itself. The two best commands I can think of would be man and apropos.