But you need to convert the url header's modified time to timestamp for comparison between computer and server files:. Comparing files based on last-modified is not the best way to do this but since you asked Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow.
Learn more. Downloading files based on timestamp in Python Ask Question. Asked 6 years, 4 months ago. Active 4 years, 5 months ago. Viewed 3k times. What is the best way to solve that? Improve this question. Alexandre Lara Alexandre Lara 2, 1 1 gold badge 23 23 silver badges 34 34 bronze badges.
Does using wget by itself work for you? Check out this post on using wget and timestamping: stackoverflow. Add a comment. Active Oldest Votes. Only then you can try finding the latest file. In general, you may use file modification time, as here: How to download only the latest file from SFTP server with Paramiko?
But in your case, I'm not sure if you can rely on the modification timestamp. It seems that you actually want to use the timestamp in the filename. With your file name format, you can simply pick the last file lexicographically. Obligatory warning: Do not set cnopts. For the correct solution see Verify host key with pysftp. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow.
Learn more. Asked 1 year, 7 months ago. Active 1 year ago. Viewed 2k times. CnOpts cnopts. Privacy policy. Applications can retrieve and set the date and time a file is created, last modified, or last accessed by using the GetFileTime and SetFileTime functions. For more information, see File Times. Not all file systems can record creation and last access times, and not all file systems record them in the same manner.
For example, on FAT file system, create time has a resolution of 10 milliseconds, write time has a resolution of 2 seconds, and access time has a resolution of 1 day really, the access date.
0コメント