정해진 목록에 따라 파일을 삭제하도록...
글쓴이: deuxweb / 작성시간: 토, 2003/08/30 - 12:31오후
정해진 목록에 따라 파일을 삭제하도록...하고 싶습니다.
파일은 PHP로 생성을 할꺼구요..
<!-- 파일 시작 -->
/home/test.test
/home/test.test2
<-- 파일 끝 -->
이런식으로 작성을 할것입니다..
crontab을 이용해서 파일을 삭제하려고 하는데 텍스트 파일을 읽어와서 한줄씩 파일이름을 불러와서 삭제하는 스크립트를 만들다 만들다 포기했습니다..
고수님들께서 좀 도와주세요..-_-;;
Forums:
Re: 정해진 목록에 따라 파일을 삭제하도록...
삭제파일 리스트의 파일명이 rm_list 라고 하면,
cat rm_list | xargs rm -f 로 충분할거 같습니다. :)
물론 crontab에 넣으실거라면 rm_list는 절대경로로 넣어 주셔야겠지요.
----
Let's shut up and code.
댓글 달기