Python script to loop through all files in directory, delete any that are less than 200 kB in size

前端 未结 4 1932
醉话见心
醉话见心 2021-01-31 03:39

I want to delete all files in a folder that are less than 200 kB in size.

Just want to be sure here, when i do a ls -la on my macbook, the file size says 171 or 143, I a

4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-31 04:10

    you can also use find

    find /path -type f -size -200k -delete
    

提交回复
热议问题