i have to delete files which are older than 15 days or more except the ones in the directory Current and also *.sh files
i have found the command for files 15 days or more older
find . -type f -mtime +15 -exec ls -ltr {} \;
but how to implement the logic to avoid directory Current and also *.sh files
plz help me in this ?
Hi,
find . -path './Current' -prune -o -not -name "*.sh" -print
will exclude the Current-directory and all *.sh-files in it. You can use
xargs rm to delete the files.
HTH Chris
demwz
3
find . -type f -mtime +15 | egrep -v -e 'Current/' -e '\.sh$' | xargs rm
the command below is working fine
find . -type f -mtime +15 | egrep -v -e 'Current/' -e '\.sh$'
but this command is not working in IBM AIX 5.3
find . -path './Current' -prune -o -not -name "*.sh" -print