{"id":3070,"date":"2023-02-20T08:00:29","date_gmt":"2023-02-20T06:00:29","guid":{"rendered":"https:\/\/ways4.eu\/?p=3070"},"modified":"2023-02-20T03:02:13","modified_gmt":"2023-02-20T01:02:13","slug":"listing-the-top-size-files-with-python","status":"publish","type":"post","link":"https:\/\/ways4.eu\/zh\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/","title":{"rendered":"Listing the top-size files with python"},"content":{"rendered":"<p><\/p>\n<h3>List Top File-size Files<\/h3>\n<p>This Python script is designed to list the top files by size on a file drive (under Windows-OS), as determined by the user.<\/p>\n<h3>Requirements<\/h3>\n<p>In order to use this script, you must have Python 3 installed on your system. You will also need to have the <code>os<\/code> and <code>sys<\/code> modules installed.<br \/>\n<!--more--><\/p>\n<p><script src=\"https:\/\/gist.github.com\/smartDevel\/79dfc6947de262c200369877de333bcd.js\"><\/script><\/p>\n<h3>Usage<\/h3>\n<ol>\n<li>Run the script from the command line using <code>python listTopFilesizedFiles.py<\/code>.<\/li>\n<li>Enter the path of the drive you would like to search when prompted.<\/li>\n<li>Enter the number of files you would like to see listed when prompted.<\/li>\n<li>Choose an action from the menu that appears:\n<ul>\n<li>Enter a file number to open that file&#8217;s location in Windows Explorer<\/li>\n<li>Enter <code>0<\/code> to exit the program<\/li>\n<li>Enter <code>r<\/code> to run the script again from the beginning<\/li>\n<\/ul>\n<\/li>\n<li>If you choose to open a file location, a Windows Explorer window will open to the directory containing the selected file.<\/li>\n<li>If you choose to exit the program, the script will end.<\/li>\n<li>If you choose to run the script again, you will be prompted to enter a new drive path and number of files to list.<\/li>\n<\/ol>\n<h3>Example<\/h3>\n<div class=\"bg-black mb-4 rounded-md\">\n<div class=\"p-4 overflow-y-auto\"><span class=\"\">\u00a0<\/span><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\">python listTopFilesizedFiles.py<br \/>\n<\/code><\/div>\n<\/div>\n<div class=\"bg-black mb-4 rounded-md\">\n<div class=\"p-4 overflow-y-auto\"><code>Enter the path of the drive you want to search: <\/code><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\">C:\\Users<br \/>\n<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\">\n<p><code>Enter the number of files to <span class=\"hljs-built_in\">list<\/span>: <span class=\"hljs-number\">10<\/span><\/code><\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"p-4 overflow-y-auto\">\n<p><code>Top <span class=\"hljs-number\">10<\/span> biggest files <span class=\"hljs-keyword\">in<\/span> C:\\Users:<\/code><\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\"><span class=\"hljs-number\">1.<\/span> File1.txt - <span class=\"hljs-number\">500<\/span> MB<br \/>\n<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\"><span class=\"hljs-number\">2.<\/span> File2.exe - <span class=\"hljs-number\">300<\/span> MB<br \/>\n<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\"><span class=\"hljs-number\">3.<\/span> File3.pdf - <span class=\"hljs-number\">200<\/span> MB<br \/>\n<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\"><span class=\"hljs-number\">4.<\/span> File4.mp4 - <span class=\"hljs-number\">150<\/span> MB<br \/>\n<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\"><span class=\"hljs-number\">5.<\/span> File5.ppt - <span class=\"hljs-number\">100<\/span> MB<br \/>\n<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\"><span class=\"hljs-number\">6.<\/span> File6.xlsx - <span class=\"hljs-number\">90<\/span> MB<br \/>\n<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\"><span class=\"hljs-number\">7.<\/span> File7.docx - <span class=\"hljs-number\">80<\/span> MB<br \/>\n<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\"><span class=\"hljs-number\">8.<\/span> File8.iso - <span class=\"hljs-number\">70<\/span> MB<br \/>\n<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\"><span class=\"hljs-number\">9.<\/span> File9.dll - <span class=\"hljs-number\">60<\/span> MB<br \/>\n<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\">\n<p><code><span class=\"hljs-number\">10.<\/span> File10.<span class=\"hljs-built_in\">zip<\/span> - <span class=\"hljs-number\">50<\/span> MB<\/code><\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\">What would you like to do?<br \/>\n<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\"><code>Enter a file number to <span class=\"hljs-built_in\">open<\/span> its location, <\/code><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\">enter <span class=\"hljs-number\">0<\/span> to exit, <span class=\"hljs-keyword\">or<\/span> enter r to start over: <span class=\"hljs-number\">2<\/span><br \/>\n<\/code><\/div>\n<div class=\"p-4 overflow-y-auto\"><code class=\"!whitespace-pre hljs language-python\">Opening File2.exe location <span class=\"hljs-keyword\">in<\/span> Windows Explorer...<br \/>\n<\/code><\/div>\n<div><\/div>\n<\/div>\n<h3>License<\/h3>\n<p>This script is released under the MIT License. Feel free to use it however you like.<\/p>\n<h3>Download<\/h3>\n<p>You can download the sourcecode and find more details on my <a href=\"https:\/\/github.com\/smartDevel\/list_Top_Size_Files\" target=\"_blank\" rel=\"noopener\">github-repository:<\/a><br \/>\n<a href=\"https:\/\/github.com\/smartDevel\/list_Top_Size_Files\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/smartDevel\/list_Top_Size_Files<\/a><\/p>\n<div style='text-align:left' class='yasr-auto-insert-overall'><\/div><div style='text-align:left' class='yasr-auto-insert-visitor'><\/div>","protected":false},"excerpt":{"rendered":"<p class=\"qtranxs-available-languages-message qtranxs-available-languages-message-zh\">\u5bf9\u4e0d\u8d77\uff0c\u6b64\u5185\u5bb9\u53ea\u9002\u7528\u4e8e<a href=\"https:\/\/ways4.eu\/en\/wp-json\/wp\/v2\/posts\/3070\" class=\"qtranxs-available-language-link qtranxs-available-language-link-en\" title=\"English\">\u7f8e\u5f0f\u82f1\u6587<\/a>\u3002<\/p>\n","protected":false},"author":1,"featured_media":2996,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_oct_exclude_from_cache":false,"_mi_skip_tracking":false,"yasr_overall_rating":0,"yasr_post_is_review":"","yasr_auto_insert_disabled":"","yasr_review_type":"","_wpoai_wizard_id":""},"categories":[115,23,97],"tags":[346,345,299,344,347,303],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Listing the top-size files with python<\/title>\n<meta name=\"description\" content=\"Learn how to use the Python script listTopFilesizedFiles.py to list and open the top files by size on a file drive.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Listing the top-size files with python\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/\" \/>\n<meta property=\"og:site_name\" content=\"\u4e25\u683c\u4fdd\u5bc6\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-20T06:00:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-02-20T01:02:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/www.ways4.eu\/wp-content\/uploads\/2023\/02\/wp-1675991345928.png?fit=409%2C409&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"409\" \/>\n\t<meta property=\"og:image:height\" content=\"409\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"pathfinder\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@sabhe011\" \/>\n<meta name=\"twitter:site\" content=\"@sabhe011\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"pathfinder\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/\"},\"author\":{\"name\":\"pathfinder\",\"@id\":\"https:\/\/ways4.eu\/#\/schema\/person\/00041dcd2cf535a70052cf591c2abd81\"},\"headline\":\"Listing the top-size files with python\",\"datePublished\":\"2023-02-20T06:00:29+00:00\",\"dateModified\":\"2023-02-20T01:02:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/\"},\"wordCount\":714,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/ways4.eu\/#\/schema\/person\/00041dcd2cf535a70052cf591c2abd81\"},\"keywords\":[\"Files\",\"List\",\"Python\",\"Script\",\"Size\",\"Windows\"],\"articleSection\":[\"Coding\",\"Computers and IT\",\"\u5f00\u59cb\"],\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/\",\"url\":\"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/\",\"name\":\"Listing the top-size files with python\",\"isPartOf\":{\"@id\":\"https:\/\/ways4.eu\/#website\"},\"datePublished\":\"2023-02-20T06:00:29+00:00\",\"dateModified\":\"2023-02-20T01:02:13+00:00\",\"description\":\"Learn how to use the Python script listTopFilesizedFiles.py to list and open the top files by size on a file drive.\",\"breadcrumb\":{\"@id\":\"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/#breadcrumb\"},\"inLanguage\":\"zh-CN\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ways4.eu\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Listing the top-size files with python\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ways4.eu\/#website\",\"url\":\"https:\/\/ways4.eu\/\",\"name\":\"\u4e25\u683c\u4fdd\u5bc6\",\"description\":\"\u4e0d\u8c08\u8bba\u5b83\",\"publisher\":{\"@id\":\"https:\/\/ways4.eu\/#\/schema\/person\/00041dcd2cf535a70052cf591c2abd81\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ways4.eu\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-CN\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/ways4.eu\/#\/schema\/person\/00041dcd2cf535a70052cf591c2abd81\",\"name\":\"pathfinder\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-CN\",\"@id\":\"https:\/\/ways4.eu\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/i0.wp.com\/www.ways4.eu\/wp-content\/uploads\/2023\/01\/wp-1674746983690.jpg?fit=702%2C841&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/www.ways4.eu\/wp-content\/uploads\/2023\/01\/wp-1674746983690.jpg?fit=702%2C841&ssl=1\",\"width\":702,\"height\":841,\"caption\":\"pathfinder\"},\"logo\":{\"@id\":\"https:\/\/ways4.eu\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/ways4.eu\",\"https:\/\/twitter.com\/sabhe011\"],\"url\":\"https:\/\/ways4.eu\/zh\/blog\/author\/pathfinder\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Listing the top-size files with python","description":"Learn how to use the Python script listTopFilesizedFiles.py to list and open the top files by size on a file drive.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/","og_locale":"zh_CN","og_type":"article","og_title":"Listing the top-size files with python","og_url":"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/","og_site_name":"\u4e25\u683c\u4fdd\u5bc6","article_published_time":"2023-02-20T06:00:29+00:00","article_modified_time":"2023-02-20T01:02:13+00:00","og_image":[{"width":409,"height":409,"url":"https:\/\/i0.wp.com\/www.ways4.eu\/wp-content\/uploads\/2023\/02\/wp-1675991345928.png?fit=409%2C409&ssl=1","type":"image\/png"}],"author":"pathfinder","twitter_card":"summary_large_image","twitter_creator":"@sabhe011","twitter_site":"@sabhe011","twitter_misc":{"\u4f5c\u8005":"pathfinder","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/#article","isPartOf":{"@id":"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/"},"author":{"name":"pathfinder","@id":"https:\/\/ways4.eu\/#\/schema\/person\/00041dcd2cf535a70052cf591c2abd81"},"headline":"Listing the top-size files with python","datePublished":"2023-02-20T06:00:29+00:00","dateModified":"2023-02-20T01:02:13+00:00","mainEntityOfPage":{"@id":"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/"},"wordCount":714,"commentCount":0,"publisher":{"@id":"https:\/\/ways4.eu\/#\/schema\/person\/00041dcd2cf535a70052cf591c2abd81"},"keywords":["Files","List","Python","Script","Size","Windows"],"articleSection":["Coding","Computers and IT","\u5f00\u59cb"],"inLanguage":"zh-CN","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/","url":"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/","name":"Listing the top-size files with python","isPartOf":{"@id":"https:\/\/ways4.eu\/#website"},"datePublished":"2023-02-20T06:00:29+00:00","dateModified":"2023-02-20T01:02:13+00:00","description":"Learn how to use the Python script listTopFilesizedFiles.py to list and open the top files by size on a file drive.","breadcrumb":{"@id":"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/#breadcrumb"},"inLanguage":"zh-CN","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ways4.eu\/blog\/2023\/02\/20\/listing-the-top-size-files-with-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ways4.eu\/"},{"@type":"ListItem","position":2,"name":"Listing the top-size files with python"}]},{"@type":"WebSite","@id":"https:\/\/ways4.eu\/#website","url":"https:\/\/ways4.eu\/","name":"\u4e25\u683c\u4fdd\u5bc6","description":"\u4e0d\u8c08\u8bba\u5b83","publisher":{"@id":"https:\/\/ways4.eu\/#\/schema\/person\/00041dcd2cf535a70052cf591c2abd81"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ways4.eu\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-CN"},{"@type":["Person","Organization"],"@id":"https:\/\/ways4.eu\/#\/schema\/person\/00041dcd2cf535a70052cf591c2abd81","name":"pathfinder","image":{"@type":"ImageObject","inLanguage":"zh-CN","@id":"https:\/\/ways4.eu\/#\/schema\/person\/image\/","url":"https:\/\/i0.wp.com\/www.ways4.eu\/wp-content\/uploads\/2023\/01\/wp-1674746983690.jpg?fit=702%2C841&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.ways4.eu\/wp-content\/uploads\/2023\/01\/wp-1674746983690.jpg?fit=702%2C841&ssl=1","width":702,"height":841,"caption":"pathfinder"},"logo":{"@id":"https:\/\/ways4.eu\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/ways4.eu","https:\/\/twitter.com\/sabhe011"],"url":"https:\/\/ways4.eu\/zh\/blog\/author\/pathfinder\/"}]}},"yasr_visitor_votes":{"number_of_votes":0,"sum_votes":0,"stars_attributes":{"read_only":false,"span_bottom":false}},"_links":{"self":[{"href":"https:\/\/ways4.eu\/zh\/wp-json\/wp\/v2\/posts\/3070"}],"collection":[{"href":"https:\/\/ways4.eu\/zh\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ways4.eu\/zh\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ways4.eu\/zh\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ways4.eu\/zh\/wp-json\/wp\/v2\/comments?post=3070"}],"version-history":[{"count":3,"href":"https:\/\/ways4.eu\/zh\/wp-json\/wp\/v2\/posts\/3070\/revisions"}],"predecessor-version":[{"id":3072,"href":"https:\/\/ways4.eu\/zh\/wp-json\/wp\/v2\/posts\/3070\/revisions\/3072"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ways4.eu\/zh\/wp-json\/wp\/v2\/media\/2996"}],"wp:attachment":[{"href":"https:\/\/ways4.eu\/zh\/wp-json\/wp\/v2\/media?parent=3070"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ways4.eu\/zh\/wp-json\/wp\/v2\/categories?post=3070"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ways4.eu\/zh\/wp-json\/wp\/v2\/tags?post=3070"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}