![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to know when a new file is created? | aixjadoo | UNIX for Dummies Questions & Answers | 1 | 07-02-2008 12:11 PM |
| File created time | yakyaj | UNIX for Advanced & Expert Users | 6 | 03-23-2007 09:20 AM |
| file was created before 15 days ago. | YoungBlood | UNIX for Dummies Questions & Answers | 1 | 03-02-2007 01:23 PM |
| Script to check for a file, check for 2hrs. then quit | mmarsh | UNIX for Dummies Questions & Answers | 2 | 09-16-2005 02:46 PM |
| Check lists for Unix Shell Programming | srikanth_ksv | Shell Programming and Scripting | 2 | 08-08-2005 06:40 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
use touch to create two files - one 30 minutes old and the other 60 minutes old.
Then use find with the -newer option Code:
touch -t 200807152100 min30 touch -t 200807152130 min60 find /path/to/files -type f \( -newer min60 -a ! -newer min30 \) |
|
||||
|
Here I have a perl script that does what you exactly want. As agrument pass the path you want to search for files:
use strict; use File::Find; my $path_to_start = $ARGV[0]; my @files_bet_30_60 = (); my $thirty_mins_in_secs = 30*60; my $sixty_mins_in_secs = 60*60; finddepth(\&wanted, $path_to_start); foreach my $file (@files_bet_30_60) { print "$file\n"; } sub wanted { my $file = $File::Find::name; next unless (-f $file); my $mtime = (stat($file))[9]; my $time_diff = time - $mtime; push @files_bet_30_60, $file if (($time_diff > $thirty_mins_in_secs) && ($time_diff < $sixty_mins_in_secs)); } Regards, Visit my blog: techdiary-viki.blogspot.com |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|