Archive

Posts Tagged ‘non-recursive’

rsync – non recursive copying

August 11th, 2009 Nick 4 comments

I was looking for a way to get rsync to copy all the files in a particular directory and not recurse into the sub-directories.   Unfortunately I couldn’t find an appropriate parameter and a quick search on Google turned up nothing (apart from a lot of other people asking the same question!)

So as a last resort I decided to use my brain, and I came up with a simple solution that works.   It’s of the form:

rsync -avc --exclude "*/" ./source/* ./destination/

The above will copy all the files from the directory called “source” into the directory “destination” and will not recurse into any subdirectories of “source”.