Article 56FDY Find and remove files

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.latest?d=yIl2AUoC8zA latest?i=J1jCEPaR7mQ:A-N7y8WO07g:F7zBnMy latest?i=J1jCEPaR7mQ:A-N7y8WO07g:V_sGLiP latest?d=qj6IDK7rITs latest?i=J1jCEPaR7mQ:A-N7y8WO07g:gIN9vFwJ1jCEPaR7mQ
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments