Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I am new to Scripting. I am trying to find out particular file is modified in last one hour or not in script and then if that file is ...
  1. #1
    Just Joined!
    Join Date
    Jun 2010
    Posts
    6

    Script to find out modified date for particular file

    Hi,

    I am new to Scripting. I am trying to find out particular file is modified in last one hour or not in script and then if that file is modified in last one hour i need to copy that file to another directory.

    Can any one please provide me how to check the file is modified in one hour or not?

    Thanks in Advance,
    Raja.

  2. #2
    Linux Engineer hazel's Avatar
    Join Date
    May 2004
    Location
    Harrow, UK
    Posts
    955
    You need to use the find command. This tests files within a directory tree that match particular criteria and prints the names of matching files. The -mmin -60 test should find files modified within the last hour. Pipe the result into the xargs command to process matching files.

    Find is a rather complex command so you will have to study its man page before proceeding.
    "I'm just a little old lady; don't try to dazzle me with jargon!"

  3. #3
    Just Joined!
    Join Date
    Jun 2010
    Posts
    6
    Thanks, I can able to do it with find....

  4. #4
    Just Joined! jippie's Avatar
    Join Date
    May 2006
    Location
    Eindhoven, the Netherlands
    Posts
    76
    check the 'stat' command.

Posting Permissions

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