shell - rsync --include --exclude simple task doesn't work -


I would like to use rsync to download specific files from a server, the directory is planned here:

 . Basically I would like to get all those files which are not in a  mainfolder. / MyFolder *  for example except for the specific  mainfolder / myfolder2 .  

What I really want to do:

  I tried rsync with the following options:  

Rsync - include = "* / main folder / myfolder2 / *" --exclude = "* / mainfolder / *"

But what I get is an empty main folder ...

  File1 fakefolder filefile More file morefakefolder file file2 file3 mainfolder    

what went wrong
  rsync --include =" * / mainfolder / myfolder2 / * "--exclude =" * / mainfolder / * "  
  1. instructions < * / mainfolder Code to include files under / myfolder2 / - Includes = "* / mainfolder / myfolder2 / *" rsync You might think that it contained The directory / code / * / mainfolder / myfolder2 / should be assigned to include, but it is not. It only contains files under that directory.

  2. The Director - excludes = "* / mainfolder / *" asks to exclude all files * / mainfolder means it does not include * / mainfolder / myfolder2 / . Because myfolder2 is excluded, files under it will never be examined.

    How to fix it

    The solution is to clearly include mainfolder / MyFolder2 :

      rsync --in clude = "mainfolder / myfolder2" - include = "main folder / myfolder2 / *" --exclude = "mainfolder / *" src / dest   

    This solution is included in clearly mainfolder / myfolder2 :

    Note that resync was included in the explanation / Are not included in which they are told, as such, it is important that - include = "mainfolder / myfolder2" before this Cut is - exclude = "mainfolder / *" . In essence, we require three directions and directive instructions are required to be finalized:

    1. - include = "mainfolder / myfolder2"

    2. - include = "mainfolder / myfolder2 / *"

    3. - out Do = "main folder / *"

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -