How to find the File Age and wait for that...


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to find the File Age and wait for that...
# 1  
Old 05-31-2005
How to find the File Age and wait for that...

Hi,
I want to know my file is 1 hr 30 min old or not,
If 1 hr 30 min old I will do some tasks in that file.. other wise I will wait to 1 hr 30 min and then do the tasks.. how to do it in Unix script? any idea?
# 2  
Old 05-31-2005
... this one uses touch to compare for file modification time ... experiment with it and you'll get the answer to your question ... (see "man touch") ...
# 3  
Old 06-01-2005
You could also check out this posting
https://www.unix.com/shell-programming-and-scripting/19013-check-if-file-modified.html

Use it as a starting reference.

Vino
# 4  
Old 06-01-2005
How about this ?

Code:
#! /bin/sh

ToM=`stat -c=%Y webtogo.cpp | awk -F"=" '{ printf $NF }'`
[ $(( `date +%s` - $ToM )) -gt 1800 ] && echo " File is older than 90 min"

ToM is Time of Modification

Vino
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Age of file

Hi All.. Is there any easy way to find out how many days older is file? for ex. fileA 20 days fileB 10 days I am currently on AIX, and there is no STAT command available in this environment. What are my options? Thanks Abhijeet R (1 Reply)
Discussion started by: freakabhi
1 Replies

2. Shell Programming and Scripting

Check age of the file

hi, i am working on a shell script where i have 2 files & i need to check age of those files. one file should be of the same day and other shoudn't be more then 20 days old. how could i acheive this? please help!!!! (10 Replies)
Discussion started by: lovelysethii
10 Replies

3. Shell Programming and Scripting

Perl Find file age

Hi I can not say that i am new to perl but today i learned something new, i wanted to know age (last time file got modified) of file so i initially thought of using find -mtime command but when i googled it, i found perl solution for the same my $age = -M $ARGV ; print "$ARGV age is... (1 Reply)
Discussion started by: zedex
1 Replies

4. Shell Programming and Scripting

Identify age of the file.

Hi all, I'm using SunOS. need to find age of the file in terms of seconds. The file name with its path will be given to the script as input. Any kinda help will be appreciated. Thanks in advance (7 Replies)
Discussion started by: bankimmehta
7 Replies

5. Shell Programming and Scripting

Find age of files...

I am trying to figure out how to look at only the following directory... /lcl/prd/data/dc003p/dump And search it for any files that have a .arc extension and are older then 24 hours. I have never done anything like this and have no idea where to start. I want to make sure it does not... (10 Replies)
Discussion started by: LRoberts
10 Replies

6. Shell Programming and Scripting

file age

How can I count the age of the file (e.g. in minutes)? (4 Replies)
Discussion started by: jarmo.leppanen
4 Replies

7. Shell Programming and Scripting

wait command - cat it wait for not-chile process?

Did not use 'wait' yet. How I understand by now the wait works only for child processes, started background. Is there any other way to watch completion of any, not related process (at least, a process, owned by the same user?) I need to start a background process, witch will be waiting... (2 Replies)
Discussion started by: alex_5161
2 Replies

8. Shell Programming and Scripting

Find the age of a file in Minutes

KSH: Please lt me know how to find the age of a file in minutes(Based on last modified time). ie, if the file was modified 15 Minutes ago, the output should be 15 (1 Reply)
Discussion started by: hari_anj
1 Replies

9. Shell Programming and Scripting

Need to execute 2 scripts, wait, execute 2 more wait, till end of file

:cool: I need to execute a shell script to do the following: cat a file run two back ground processes using the first two values from the file wait till those background processes finish run two more background processes using the next two values from the file wait till those background... (1 Reply)
Discussion started by: halo98
1 Replies

10. UNIX for Dummies Questions & Answers

find a process age

I can write a script to use ps and interigate the output, but is there a command that works similar to the find command for files where I can request a list of all the running processes over 1 day old ? thanks! (8 Replies)
Discussion started by: MizzGail
8 Replies
Login or Register to Ask a Question