Find and remove files
by hottdogg from LinuxQuestions.org on (#56FDY)
I need to remove files in a folder, periodically (using cron) and need to log the removal to a log file.
File name may contain whitespace in the middle.
Code:FINISHED_DIR=/foo/bar/dir1
for x in $(find ${FINISHED_DIR} -iname '*mp4')
do
rm -v "$x" >> removed_finished.log
doneThe script able to remove normal file without space but cannot remove file with space.
Anybody can give alternative solutions?
Thanks.


File name may contain whitespace in the middle.
Code:FINISHED_DIR=/foo/bar/dir1
for x in $(find ${FINISHED_DIR} -iname '*mp4')
do
rm -v "$x" >> removed_finished.log
doneThe script able to remove normal file without space but cannot remove file with space.
Anybody can give alternative solutions?
Thanks.