mar10 / pyftpsync

Synchronize directories using FTP(S), SFTP, or file system access.
https://pyftpsync.readthedocs.io
MIT License
117 stars 25 forks source link

[v2.0] exclude files #31

Closed Squale76 closed 6 years ago

Squale76 commented 6 years ago

Hi, I tried to use your very good script in mine to update my web site. But I can't use exclude option. When I try :

local = FsTarget( path_TmpGIT )
remote = FtpTarget("/", ftpHOST, username=ftpUSER, password=ftpPASS)
opts = {"force": True, "delete_unmatched": True, "verbose": 5, "no_color": True}
s = UploadSynchronizer(local, remote, opts)
s.run()

My .git folder is upload despite the default option. And when i tried, it's not better :

local = FsTarget( path_TmpGIT )
remote = FtpTarget("/", ftpHOST, username=ftpUSER, password=ftpPASS)
opts = {"force": True, "delete_unmatched": True, "verbose": 5, "no_color": True, "exclude": ".git"}
s = UploadSynchronizer(local, remote, opts)
s.run()
mar10 commented 6 years ago

The default excludes (['.DS_Store', '.git', '.hg', '.svn']) are currently only applied by the CLI, not when running as library script. I just tested this, and it seemed to work:

local = FsTarget("/path1")
remote = FsTarget("/path2")
opts = {
    "verbose": 5,
    "dry_run": True,
    "exclude": ".git",
    }
s = UploadSynchronizer(local, remote, opts)
s.run()

The local path contains a .git folder, and the output shows:

INFO:pyftpsync:(DRY-RUN) SKIP UNMATCHED    -  [.git]          

Can you post your output, or even set a breakpoint to see what's happening?