Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get latest file from ftp #2

Open
jacobdadams opened this issue Nov 16, 2021 · 0 comments
Open

Get latest file from ftp #2

jacobdadams opened this issue Nov 16, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@jacobdadams
Copy link
Member

From @steveoh:

Two other use cases we've had for this are, download all the csv's in a directory and download this specific file. It would be nice to provide some metadata about the file from the sftp as well since one of those use cases stored the modified date and would compare it to the last run to ensure it wasn't loading the same data twice.

remote_mtime = sftp.stat(file_path).st_mtime

if remote_mtime > mtime:
    self.log.debug('downloading {}'.format(file_path))
    sftp.get(file_path, local_path, preserve_mtime=True)

    return True
@jacobdadams jacobdadams added the enhancement New feature or request label Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant