rsync – non recursive copying
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”.
A year and a half later and your tip kept me from spinning my wheels for at least two hours. Thank you!
@Ben
Thanks for the comment – it’s nice to know it was useful for at least someone!
This was also very helpful for me, although I’m guilty of tire spinning
The rsync -d flag sounds like it ought to do this, but not so… Your solution above works perfectly!
Yes! Thanks very much for this little note