-4
파이썬 스크립트 내에서 ftputil을 사용하여 디렉토리의 파일을 마지막으로 수정/생성 한 날짜를 얻었습니다. 문제가 적고 도움이 될지 궁금합니다.파이썬 스크립트 내에서 ftputil을 사용하고 있습니다.
host.stat_cache.resize(200000)
recursive = host.walk(directory, topdown=True, onerror=None)
for root,dirs,files in recursive:
for name in files:
#mctime = host.stat(name).mtime
print name
위의 출력 디렉토리
host.stat_cache.resize(200000)
recursive = host.walk(directory, topdown=True, onerror=None)
for root,dirs,files in recursive:
for name in files:
if host.path.isfile("name"):
mtime1 = host.stat("name")
mtime2 = host.stat("name").mtime
#if crtime < now -30 * 86400:
#print name + " Was Created " + " " + crtime + " " + mtime
print name + " Was Created " + " " + " " + mtime1 + " " + mtime2
위의 모든 파일의 목록은 당신이 따옴표로 name
을 넣었습니다
여기서 "당신"은 누구입니까? 또한 코드를 살펴보면'files' 또는'recursive'가 비어 있거나'isfile' 검사가 실패 할 경우 출력을 얻을 수 없습니다. 루프 앞에서'print files'와'print recursive'를 추가하십시오. – Daenyth
재귀 = host.walk 재귀의 뿌리, DIRS, 파일 (디렉토리, 하향식 = 사실의 OnError = 없음) : 이름 파일 : #mctime = host.stat (이름) 위의 .mtime 인쇄 이름 – Echo
재귀 적으로 파일 목록을 생성하고 파일에 무언가가 들어있다. – Echo