Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Location
    India
    Posts
    2

    Post Unanswered: To delete files not currenlty used

    Hi All
    Iam currently facing a problem wherin i need to delete files *.log older than 14 days in a directory but exclude files which are currently not being open/used by any processes. can someone help me with the script????
    I understand that using
    find /app/minotaur/Log -atime 14 -exec rm {} \;
    will remove all files whose acess timeisless than 14 days but wat abt those files which are not been written into for past 14 days but are still opened by some process

    Thanks in advance

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    780

    Re: To delete files not currenlty used

    Originally posted by inderpal
    Hi All
    Iam currently facing a problem wherin i need to delete files *.log older than 14 days in a directory but exclude files which are currently not being open/used by any processes. can someone help me with the script????
    I understand that using
    find /app/minotaur/Log -atime 14 -exec rm {} \;
    will remove all files whose acess timeisless than 14 days but wat abt those files which are not been written into for past 14 days but are still opened by some process

    Thanks in advance
    Hi,

    You tested with mtime, instead atime.

    Gustavo.

  3. #3
    Join Date
    Nov 2003
    Location
    India
    Posts
    2
    hello gustavo
    yeah even mtime can be used.but i have asituation wherein something is written into the log file only when there is an error,So if i blinldy use mtime or atime i wil even delete those files which are currently opened by my application and the application is running without error for last 14 days.So i need a script which will only delete log files which are not opened by any application and are 14 days old.
    Thanks

  4. #4
    Join Date
    Oct 2003
    Location
    Germany
    Posts
    138
    Hi inderpal,
    I think there is no solution for your problem. If you can edit the program
    (source code) make a touch dayly to the file or open every day a new file whith date in the filename. Exampe "myprog[mmddyy].log"
    Then your "find bla bla" will works.
    Greetings from germany
    Peter F.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •