I was experimenting something different with find. I just wanted to move all my .c files under my root to my source directory. Though, I've no idea how to exclude some directories where I don't want to pick up my files.
The line of code I should improve is the following:
sudo find / -type f -name "*.c" -exec cp {} ~/my/source/directory \;
Since there are different .c files in my source directory, copying files to the same path where the files are picked up would raise an error (it would work anyway, though). Also, this would happen anyway even if I had no file in my source directory, since they were copied there before.
So, my line should look like the following:
sudo find / -type f -name "*.c" EXCEPT ~/my/source/directory -exec cp {} ~/my/source/directory
Is there anyway to do that? I've looked up in man pages as well as in my reference manual (there is something similar there even if I couldn't emulate it), but I wasn't able to find nothing helpful.
Any help appreciated.
EDIT:
find man page is clear about it. If interested, you can find the solution to my problem at line 343 (343G on less).