Skip to content →

Listing the top-size files with python

List Top File-size Files

This Python script is designed to list the top files by size on a file drive (under Windows-OS), as determined by the user.

Requirements

In order to use this script, you must have Python 3 installed on your system. You will also need to have the os and sys modules installed.

Usage

  1. Run the script from the command line using python listTopFilesizedFiles.py.
  2. Enter the path of the drive you would like to search when prompted.
  3. Enter the number of files you would like to see listed when prompted.
  4. Choose an action from the menu that appears:
    • Enter a file number to open that file’s location in Windows Explorer
    • Enter 0 to exit the program
    • Enter r to run the script again from the beginning
  5. If you choose to open a file location, a Windows Explorer window will open to the directory containing the selected file.
  6. If you choose to exit the program, the script will end.
  7. If you choose to run the script again, you will be prompted to enter a new drive path and number of files to list.

Example

 
python listTopFilesizedFiles.py
Enter the path of the drive you want to search:
C:\Users

Enter the number of files to list: 10

 

Top 10 biggest files in C:\Users:

 

1. File1.txt - 500 MB
2. File2.exe - 300 MB
3. File3.pdf - 200 MB
4. File4.mp4 - 150 MB
5. File5.ppt - 100 MB
6. File6.xlsx - 90 MB
7. File7.docx - 80 MB
8. File8.iso - 70 MB
9. File9.dll - 60 MB

10. File10.zip - 50 MB

 

What would you like to do?
Enter a file number to open its location,
enter 0 to exit, or enter r to start over: 2
Opening File2.exe location in Windows Explorer...

License

This script is released under the MIT License. Feel free to use it however you like.

Download

You can download the sourcecode and find more details on my github-repository:
https://github.com/smartDevel/list_Top_Size_Files

Click to rate this post!
[Total: 0 Average: 0]

Published in Coding Computers and IT Start

Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.