Rsync filter and ignore some directoriesrsync --files-from equivalentrsync not syncing certain directoriesHow...

What (if any) is the reason to buy in small local stores?

How to read string as hex number in bash?

What is the reasoning behind standardization (dividing by standard deviation)?

Unable to get newly inserted Product's Id using After Plugin for Catalog Product save controller method

Writing in a Christian voice

What will the Frenchman say?

Animating wave motion in water

Jem'Hadar, something strange about their life expectancy

Was World War I a war of liberals against authoritarians?

Why I don't get the wanted width of tcbox?

Does the Shadow Magic sorcerer's Eyes of the Dark feature work on all Darkness spells or just his/her own?

Does convergence of polynomials imply that of its coefficients?

Print a physical multiplication table

How do researchers send unsolicited emails asking for feedback on their works?

Why is participating in the European Parliamentary elections used as a threat?

PTIJ: Where did Achashverosh's years wander off to?

How to test the sharpness of a knife?

Imaginary part of expression too difficult to calculate

Nested Dynamic SOQL Query

Is xar preinstalled on macOS?

When should a starting writer get his own webpage?

Should a narrator ever describe things based on a characters view instead of fact?

Do people actually use the word "kaputt" in conversation?

Hackerrank All Women's Codesprint 2019: Name the Product



Rsync filter and ignore some directories


rsync --files-from equivalentrsync not syncing certain directoriesHow do rsync --filter / -F and the --files-from options interact?Syncing files with rsync by file names only, ignore directoriesrsync filter file rules for subpathrsync not deleting foldersPrevent rsync from deleting excluded directoriesrsync - exclude all directories except a fewIn an rsync, how do I exclude all directories that match a pattern?renaming directories under backup with rsync













3















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
















bumped to the homepage by Community 8 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 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
















3















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
















bumped to the homepage by Community 8 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 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














3












3








3


1






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
















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.







rsync filter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 30 '13 at 16:18







John Smith Optional

















asked Aug 30 '13 at 16:00









John Smith OptionalJohn Smith Optional

2582417




2582417





bumped to the homepage by Community 8 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 8 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 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














  • 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








1




1





Look at the --exclude-from option.

– SunSparc
Aug 30 '13 at 16:13





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







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





What have you already tried with --exclude that didn't work?

– sciurus
Aug 30 '13 at 19:43










2 Answers
2






active

oldest

votes


















0














rsync -a --exclude '__pycache__' source/ destination/





share|improve this answer



















  • 1





    That doesn't work. The __pycache__ directory is still sent.

    – John Smith Optional
    Nov 2 '15 at 22:07





















0














rsync -a --exclude "__pycache__/" source/ destination/



You may also want to pass --delete-excluded to remove __pycache__ files that have been copied (of course it removes all other excluded files from the destination too too).






share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "2"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f535189%2frsync-filter-and-ignore-some-directories%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    rsync -a --exclude '__pycache__' source/ destination/





    share|improve this answer



















    • 1





      That doesn't work. The __pycache__ directory is still sent.

      – John Smith Optional
      Nov 2 '15 at 22:07


















    0














    rsync -a --exclude '__pycache__' source/ destination/





    share|improve this answer



















    • 1





      That doesn't work. The __pycache__ directory is still sent.

      – John Smith Optional
      Nov 2 '15 at 22:07
















    0












    0








    0







    rsync -a --exclude '__pycache__' source/ destination/





    share|improve this answer













    rsync -a --exclude '__pycache__' source/ destination/






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Aug 30 '13 at 19:47









    sciurussciurus

    10.9k21943




    10.9k21943








    • 1





      That doesn't work. The __pycache__ directory is still sent.

      – John Smith Optional
      Nov 2 '15 at 22:07
















    • 1





      That doesn't work. The __pycache__ directory is still sent.

      – John Smith Optional
      Nov 2 '15 at 22:07










    1




    1





    That doesn't work. The __pycache__ directory is still sent.

    – John Smith Optional
    Nov 2 '15 at 22:07







    That doesn't work. The __pycache__ directory is still sent.

    – John Smith Optional
    Nov 2 '15 at 22:07















    0














    rsync -a --exclude "__pycache__/" source/ destination/



    You may also want to pass --delete-excluded to remove __pycache__ files that have been copied (of course it removes all other excluded files from the destination too too).






    share|improve this answer




























      0














      rsync -a --exclude "__pycache__/" source/ destination/



      You may also want to pass --delete-excluded to remove __pycache__ files that have been copied (of course it removes all other excluded files from the destination too too).






      share|improve this answer


























        0












        0








        0







        rsync -a --exclude "__pycache__/" source/ destination/



        You may also want to pass --delete-excluded to remove __pycache__ files that have been copied (of course it removes all other excluded files from the destination too too).






        share|improve this answer













        rsync -a --exclude "__pycache__/" source/ destination/



        You may also want to pass --delete-excluded to remove __pycache__ files that have been copied (of course it removes all other excluded files from the destination too too).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 4 '16 at 12:50









        ideasman42ideasman42

        1011




        1011






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Server Fault!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f535189%2frsync-filter-and-ignore-some-directories%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            As a Security Precaution, the user account has been locked The Next CEO of Stack OverflowMS...

            Список ссавців Італії Природоохоронні статуси | Список |...

            Українські прізвища Зміст Історичні відомості |...