2021년 6월 8일 화요일

tip: find "*.xxx" files recursively and remove them in linux

my solution: combine "find" and python

(1) find . -type f -name "*.xxx" > tt

(2) do following in python 

    import os

    ff= open('tt','r');fnames=ff.readlines();ff.close()

   for i in fnames:

    os.remove(i[:-1]) # remove \n in the end 


댓글 없음:

댓글 쓰기