Re: Help with command - cp
Le 26.01.2014 15:26, Lisi Reisz a écrit :
I am wanting to use the CLI to copy some files from dirA to dirB.  I
want to exclude all hidden files.  Will this command achieve it? :--
cp -Rp /path/to/sourcedir/A/* /path/to/destinationdir/B
Thanks,
Lisi
Just a note, too late but it could help later too, for another problem.
What I would have made is a quick and dirty method: first a classic 
copy ( I do not know rsync too )
$cp -r ~/foo ~/bar
And then:
$ cd ~/bar && rm `find -name '.*'`
Indeed, it have really poor performances (in term of computer ones), 
since some files are first copied and then deleted, but it should work ( 
did not tried, actually ) and does not require any learning except the 
very basic use of find, in case you do not already know it.
Could be made in a better way of the same direction, maybe by using 
find to select stuff to copy, but I take for sure that the lines will be 
quite more complex, as find is a really powerful tool, but it's man is 
not really clear about how to do stuff which could be considered basic. 
I can remember having some pain with it for more complex things like 
excluding some directories and only selecting files with different 
extensions.
Note that folders . and .. can not be removed so you will warnings, but 
those are simply warnings.
This is just another (and a dirty one) way to do the thing you needed 
:)
Reply to: