Aug-08-2018, 11:15 PM
I am trying to write a script to get the latest file from the latest sub- directory of FTP server in python. My problem is i am unable to figure out the latest sub-directory. There are 2 options available, sub-directories have ctime available. Also in directory name date is mentioned that on which date directory was created.But i do not know how to get the name of the latest directory. I have figured out the following way(hoping for the server side to be sorted by latest c time but it is super slow.
import ftplib
import os
import time
ftp = ftplib.FTP('test.rebex.net','demo', 'password')
ftp.cwd(str((ftp.nlst())[0])) #if directory is sorted in descending order by date.
But is there any way where i will find the exact directory by Ctime or by date in directory name ?
Thanks a lot guys
import ftplib
import os
import time
ftp = ftplib.FTP('test.rebex.net','demo', 'password')
ftp.cwd(str((ftp.nlst())[0])) #if directory is sorted in descending order by date.
But is there any way where i will find the exact directory by Ctime or by date in directory name ?
Thanks a lot guys