Hello,
I see three things.
First the -type d is looking for directories not files.
Second, you don't need the asterisk on the directory
Third, I normally run a test command using* ls *instead of rm to make sure the output I am getting is what I intended.
find /Volumes/Backup/ -type f -mtime +90 -exec /bin/ls -la {} \;
rch1231
Veteran Poster
1,040 posts since Sep 2009
Reputation Points: 142
Solved Threads: 154
Skill Endorsements: 12
Hello,
Sorry to take so long responding but it has been busy at work.
The find command I gave you looks for files older than 90 days not directories. Linux does not update the directory date when files are changed or copied into a directory so the directories you created will have their original date instead of the latest date. That is why all of your files were deleted.
The reason I replaced the rm with ls -la is to show you what results your find is getting. I have made it a rule to run any find that deletes files using the ls -la command first so I can verify what the rm command is going to delete. Peraonally I also am very nervious about running a rm -R via a script. For example what if your find command somehow detected the .. directory reference as a directory older than 90 days and therefor did an rm -R .. and was able to get up the the / directory. It could conceivablly deleted every file on the system.
I also suggest that you run the find and redirect the output to a file and keep the file for a few days so you can verify what you deleted.
rch1231
Veteran Poster
1,040 posts since Sep 2009
Reputation Points: 142
Solved Threads: 154
Skill Endorsements: 12