Find directories only and delete them created 3 days before

Hello

I have some directories and files created under /export/local/user

I would like to delete directories only under /export/local/user, created before 3 days

Can someone help me with command to do this task?

Thanks

If you delete a directory with files in it you have to delete the files, too.

Plus there no notion of 'created date' in unix.
mtime=last modification atime=last time of access ctime=last inode change

find /export/local/user  -type d  -mtime +3 -exec rm -r {} \;

Hi,

How can I delete all files in a directory that starts with the name "STW*" through a shell script ksh. Can I use the mtime in this case. Will the following command work, or let me know how I could do it with other alternatives. Please note that this would be part of a ksh script and the command is not run manually.

 
find /export/local/user/tmp \( -name "STW*" \) -mtime +0 -exec rm -f {} \;

Hi Jmathew99,

Could you please explain why have u used -mtime here? I don't see any use of it here. And also I don't think u need to put -name wthin braces.

Thanks

Hi,

Can you please let me know the code after correction.