I am creating a script in Red Hat Enterprise Linux Server release 7.5 (Maipo) to find all files named test*.txt
that are 10 days older than 6 months. The original directory that I'm copying from contains a valid file, however when I try to move the files it errors out. The script and the error message is listed below. Why does it fail and what I can do to fix it?
find /INTER/f/d/o/ -type f -name "test*.txt" -mtime +190 -exec mv /INTER/f/d/o/"test*.txt" /INTER_ARCHIVE/f/d/o/ {} \;
mv: target /INTER/f/d/o/test1.txt is not a directory
mv: target /INTER/f/d/o/test2.txt is not a directory
mv: target /INTER/f/d/o/test3.txt is not a directory
mv: target /INTER/f/d/o/test4.txt is not a directory
Also, after the files have sat in the archive directory for 7 months plus 10 days delete them. Using the script below, I get the following error.
find /INTER_ARCHIVE/f/d/o/ -type f -name "test*.txt" -mtime +400 -exec rm {};
find: missing argument to `-exec'
echo
in front of themv
so you can see the command being run. – Chris Davies May 26 '18 at 08:13