Sample Header Ad - 728x90

Why does "find . -type d -empty -mtime +7 -delete" produce "No such file or directory" error messages?

0 votes
1 answer
132 views
I've found similar questions being answered, where the find command encounters errors deleting files. However, the most similar question with an answer on Stack Exchange is regarding the find -type d -exec rmdir {} \; command. People have recommended using the find command with -delete instead because the -delete option implies -depth, which has the find command use depth-first search to delete files. That makes sense to me, but I am using the command people recommend find . -type d -empty -mtime +7 -delete to delete empty directories older than 7 days old. Yet, I still encounter the error No such file or directory. Interestingly, when I go to the directories that do not exist, I cannot find them. Is it deleting the directories despite the error?
Asked by Mory (1 rep)
Aug 27, 2024, 07:54 PM
Last activity: Aug 28, 2024, 02:13 AM