Under TEMP folder, it have many sub-folder, example"0015,0016,etc"
I need to discovery those file which are 2 days ago in this sub-folder , and list out to investigate, at the end delete all file in those sub folder, only keep the emptu directory. Thanks
find -mtime +2 -exec rm {} \;
Try this ,
find /tmp/ -mtime +2 -type f -exec rm {} \;
Do not execute the "find" commands from the previous posts. They will delete a lot more than you want and could crash your system.
This script looks for directories with a four character numeric name, then searches those directories for old files. It then echoes the command which would be executed so you can test the script without deleting anything.
find /temp_folder_name/ -type d -name '[0-9][0-9][0-9][0-9]' -print | while read DIR
do
find "${DIR}" -type f -mtime +2 -print | while read FILENAME
do
# Remove echo only if you are happy
echo rm "${FILENAME}"
done
done
GOOD, THANKS
I WILL TRY IT