Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- def szukajka():
- discs = ["D:/"]
- currentDir = ""
- importantDataDictionary = {}
- importantDataDictionary["eldestFileTime"] = 0
- importantDataDictionary["eldestFileDir"] = ""
- importantDataDictionary["largestFileSpace"] = 0
- importantDataDictionary["largestFileDir"] = ""
- importantDataDictionary["longestFileDir"] = ""
- recurringSearcher(currentDir, discs, importantDataDictionary)
- print(importantDataDictionary["eldestFileDir"])
- print(importantDataDictionary["largestFileDir"])
- print(importantDataDictionary["longestFileDir"])
- def recurringSearcher(currentDir, directoryList, dictionaryThatTricksMadafapinPython):
- for fileName in directoryList:
- nextDir = os.path.join(currentDir, fileName)
- if nextDir != 'D:/Config.Msi':
- if nextDir != 'D:/System Volume Information':
- if len(nextDir) > len(dictionaryThatTricksMadafapinPython["longestFileDir"]):
- dictionaryThatTricksMadafapinPython["longestFileDir"] = nextDir
- if os.path.isfile(nextDir):
- if dictionaryThatTricksMadafapinPython["eldestFileTime"] < os.path.getctime(nextDir):
- dictionaryThatTricksMadafapinPython["eldestFileTime"] = os.path.getctime(nextDir)
- dictionaryThatTricksMadafapinPython["eldestFileDir"] = nextDir
- if dictionaryThatTricksMadafapinPython["largestFileSpace"] < os.path.getsize(nextDir):
- dictionaryThatTricksMadafapinPython["largestFileSpace"] = os.path.getsize(nextDir)
- dictionaryThatTricksMadafapinPython["largestFileDir"] = nextDir
- if os.path.isdir(nextDir):
- nextDirectoryList = os.listdir(nextDir)
- recurringSearcher(nextDir, nextDirectoryList, dictionaryThatTricksMadafapinPython)
- szukajka()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement