Created
December 25, 2020 15:27
-
-
Save kotoripiyopiyo/9be71d634a5e8ed573391ecee70ed505 to your computer and use it in GitHub Desktop.
ディレクトリツリーを渡り歩き1GB以上のファイルをリストアップする
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! python3 | |
# ディレクトリツリーを渡り歩き1GB以上のファイルをリストアップする | |
import os | |
def gigafile(folder): | |
for foldername, subfolders, files in os.walk(folder): | |
for file in files: | |
if os.path.getsize(os.path.join(foldername, file)) > 1000000000: | |
print(str(os.path.getsize(os.path.join(foldername, file))) + ' ; ' + os.path.join(foldername, file)) | |
print('終了しました') | |
gigafile('絶対パス') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment