Merge folder contents in OSX/*nix


Re: Merge folder contents in OSX/*nix
#3
In proof form:
Quote:Let the desired output of merge(main, new) be defined by the union of the set of all files in main/new and the set of all files in new, where, when these sets intersect, the files in new are assumed to be the desired files.

Let LDraw be a directory arranged like so:
Code:
$ mkdir LDraw
$ mkdir LDraw/parts
$ touch LDraw/parts/A.dat
Let your new folder, parts, be arranged like so:
Code:
$ mkdir parts
$ touch parts/B.dat

Given the above directories, the following copy will "merge" parts into LDraw:
Code:
$ cp -r parts LDraw
Thus arriving at:
Code:
$ ls LDraw/parts
A.dat    B.dat

Q.E.D.

and then rm -r parts if you want to. As far as I am aware, there is no portable way to do this with mv.

AFAIK there isn't some modifier key you can hold down to do what you want (like option to copy, or cmd option to make a symlink (or "alias" as they are called on mac)).

However, if you're only dealing with LDraw folders... I always just select the files themselves, it's really not that big of a deal since we only have 4 folders (or 8 if you count unofficial/*).

Not an elegant solution by any means, it's just what I find most practical.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
Re: Merge folder contents in OSX/*nix - by Jean-Philippe Ouellet - 2012-01-24, 4:31

Forum Jump:


Users browsing this thread: 1 Guest(s)