I am a newbie to python and linux. I want a solution for listing the files and folders based on the timestamp. I know this is already asked. But I cannot get an insight in what I am doing. I want the code to return the latest created file or folder. I have a script that identifies the type of content(file or folder). I need it to get the latest created content. The content identifier goes like this.
import os
dirlist=[]
dirlist2=[]
for filename in os.listdir('/var/www/html/secure_downloads'):
if (os.path.isdir(os.path.join('/var/www/html/secure_downloads',filename))):
dirlist.append(filename)
else:
dirlist2.append(filename)
print "For Folders",dirlist
print "For Files",dirlist2