Bounce notice: If you read this list through Indexfocus, Nabble, or any other replicator - and you would like to be able to participate - sign up directly with us. Here's all you need to know: To subscribe or resubscribe please visit http://listserver.u2ug.org/.
REPOSTED FOR NON-MEMBER ADDRESS: [EMAIL PROTECTED] One thing everyone should remember when using find is that it is best to specify the exact directory that you want it to work on. cd /ud/production/_PH_ find . -mtime +90 -exec rm {} \; That works fine if you are manually typing it in and have confirmed that you are in the proper directory. But a dangerous problem arises if you are running the find command in a script or you neglect to verify what directory you are in. The "." tells find to start searching in the current directory. For example: #!/bin/ksh cd /ud/production/_PH_ find . -mtime +90 -exec rm {} \; The above script works perfectly until the directory structure is changed or a drive mount fails to mount. What happens then is that the cd line fails but the "find" command is still active in the script. Then the find command then starts executing in whatever directory the script is running in. If it is a cron job run by root then the active directory is: / The find command will then go through the entire disk happily deleting any file older than 90 days and before you know it, you have a lot of extra drive space. To stop that from happening always specify what directory that you want find to start looking in, don't use the ".", instead type it in like this: find /ud/production/_PH_ -mtime +90 -exec rm{} \; Sure, it is a little bit more typing but in the long run it will save you a lot of extra work restoring files. Here is how I script my routines to purge old files: #!/bin/ksh if cd /ud/production/_PH_ then find /ud/production/_PH_ -mtime +90 -exec rm {} \; else echo Directory is missing fi If the /ud/production/_PH_ directory is missing or unmounted the script does nothing more than print "Directory is missing", it skips the find command altogether. The find command specifically states what directory to work in also. Jim ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/