Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'd like to rsync a directory that contains a Python 3 app on my server.

The directory has files I'm interested in: the files that end with .py

And there are the files I'd like to be ignored (these are the files that are inside a __pycache__ directory). (note: there could be __pycache__ directories in any subdirectory of my project). I'd like these __pycache__ directories to be ignored, wherever they appear).

I thought there should be an easy way to do this but couldn't find it. The --filter option appears to be undocumented and the --exclude option doesn't work as described in the rsync help.

share|improve this question
1  
Look at the --exclude-from option. –  SunSparc Aug 30 '13 at 16:13
    
I don't know in advance where nor how many the __pycache__ directories are going to be. –  John Smith Optional Aug 30 '13 at 16:30
    
What have you already tried with --exclude that didn't work? –  sciurus Aug 30 '13 at 19:43
add comment

1 Answer 1

rsync -a --exclude '__pycache__' source/ destination/
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.