import time
import os
import sys
def dirl(dir):
try:
for x in os.listdir(dir):
y=os.path.join(dir,x)
if os.path.isfile(y):
print (time.strftime("%m-%d-%Y %X",time.localtime(os.path.getctime(y))),os.path.getsize(y), x.lower())
elif os.path.isdir(y):
#dirl (y) #go through subdir if needed
print (time.strftime("%m-%d-%Y %X",time.localtime(os.path.getctime(y))),'<DIR>', x.lower())
except Exception as e:
print (e)
dirl ('.')
dirl(r'C:\Windows')
Sign in to make a reply
本地的Yoyo
import time
import os
import sys
def dirl(dir):
try:
for x in os.listdir(dir):
y=os.path.join(dir,x)
if os.path.isfile(y):
print (time.strftime("%m-%d-%Y %X",time.localtime(os.path.getctime(y))),os.path.getsize(y), x.lower())
elif os.path.isdir(y):
#dirl (y) #go through subdir if needed
print (time.strftime("%m-%d-%Y %X",time.localtime(os.path.getctime(y))),'<DIR>', x.lower())
except Exception as e:
print (e)
dirl ('.')
dirl(r'C:\Windows')