리눅스 파일이름으로 된 목록을 불러와서 해당 파일 지우기
지울 파일들의 이름을 files_to_remove.txt
에 한줄에 하나씩 넣어놓고, 다음 명령들을 이용해서
일괄적으로 지운다.
Bash
Bash의 명령어 대치 (Command Substitution) 기능을 이용한 방법
rm -rf `cat /path/to/files_to_remove.txt`
xargs
파일명의 공백, 특수문자도 처리가능.
xargs -d '\n' -a files_to_remove.txt rm
cat files_to_remove.txt | xargs rm
스크립트
while read files_to_remove.txt ; do rm "$filename" ; done < files.lst
펄(perl)
perl -lne 'unlink' files_to_remove.txt