LoginSignup
0
0

More than 1 year has passed since last update.

15byteより小さいファイルをゴミとして特定のディレクトリへ移動する。

Last updated at Posted at 2022-04-12
import shutil
import os

os.mkdir('trash')

def isTrash(file):
    return os.path.getsize(file) < 15

for f in os.listdir(path='.'):
    if isTrash(f):
        shutil.move(f, 'trash')
    elif os.path.isfile(f):
        print('file operation:' + f)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0