Selective recursive file copy

Tony suggested I post useful tips to my blog. He persuaded me to start the Vim category, and now suggested I post this too.

There are lots of little things I do that I don’t think are interesting or useful, but Tony thinks they are when he sees them. I suppose this could be a case of familiarity breeds contempt; I don’t recognise how useful something could be because I use it all the time.

Anyway, today Tony wanted to recursivly copy all the regular files from his current directory to another one; he didn’t want to copy symlinks or anything else. As usual, he wanted a one-liner. So, I did this:

tar cf - `find . -type f -print` | tar xCf /home/tony/otherdir -

Leave a Reply

Your email address will not be published.