I'm working on a cleanup script for tv shows that I download. Right now I'm just looking for a file greater than 50mb, but there should be a better way.
OK, check this out. The code you're using to find files is pretty good. If you're looking to improve that part of the code you could use recursion so that your function will descend into subdirectories and pull out those files too. Here is some code I whipped up that will print the number of files in all the subdirectories under a folder.
Now you want to get the list of files and the file size, so I would suggest putting them into a list of tuples which you can sort to get the biggest file of them all. Change the line where we add the file name to the list so that it adds a tuple containing the file name and size.
Then your last task is to sort the list of tuples with Final_List_of_Files.sort(). You'll have to reverse the sort order so that you can the largest file in the top position. Here is the final code
Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
This thread is more than three months old
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.