The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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
Auto copy for files from folder to folder upon instant writing Bashar UNIX for Advanced & Expert Users 2 08-21-2008 02:44 PM
How to display contents of folder when 'cd' is used mumashankar UNIX for Dummies Questions & Answers 3 03-06-2008 07:42 PM
display the files in a folder which are older than 1 hour vgs UNIX for Dummies Questions & Answers 3 05-25-2007 08:46 PM
Logic behind display of .www folder ?? srinivasan_85 UNIX for Dummies Questions & Answers 10 01-13-2007 06:41 AM
Need to process files created an hour ago negixx Shell Programming and Scripting 9 06-15-2005 01:31 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-25-2007
vgs vgs is offline
Registered User
  
 

Join Date: May 2007
Posts: 10
display the files in a folder which are older than 1 hour

Hi,

I have some files in a folder with different time stamps and
I want to display the files which are older than 1 hour.

i tried with find.

need urgent help.
  #2 (permalink)  
Old 05-25-2007
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,414
Search Forum before posting ...
See move log files over 12 hours old...
and date/time


Jean-Pierre.
  #3 (permalink)  
Old 05-25-2007
vgs vgs is offline
Registered User
  
 

Join Date: May 2007
Posts: 10
I have written the below ksh script(in sun solaris) using one old posting but i am getting an error message saying that " ./fileage: not found".

Looks like the fileage is not recognized.
please can any one help.

#!/bin/ksh
AGE=$1
cd c:/temp
for file in $(ls)
do
echo "in the for loop"
if [[ $(( $(./ $file)/60)) -ge $AGE ]]
then
echo $file >>outputfiles.txt
fi
done >outputfiles.txt

final=`wc -l outputfiles.txt|awk '{print $1}'`
if [ $final -ge 1 ]
then
echo $final|mailx -s "Unprocessed Files in blabla" abc.xyz@yahoo.com
else
echo "Everything's OK"
fi
  #4 (permalink)  
Old 05-25-2007
aigles's Avatar
aigles aigles is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2004
Location: Bordeaux, France
Posts: 1,414
I don't understand what you want to do in the following statement :
Code:
if [[ $(( $(./ $file)/60)) -ge $AGE ]]
If possible, give us examples of input files and results that you expect.

Jean-Pierre.
  #5 (permalink)  
Old 05-25-2007
cfajohnson's Avatar
cfajohnson cfajohnson is offline Forum Advisor  
Shell programmer, author
  
 

Join Date: Mar 2007
Location: Toronto, Canada
Posts: 2,361
Quote:
Originally Posted by vgs
Hi,

I have some files in a folder with different time stamps and
I want to display the files which are older than 1 hour.

i tried with find.

Folder? Do you mean directory?

If you have GNU (or FreeBSD) find:

Code:
find . -maxdepth 1 -type 5 -mmin +60
  #6 (permalink)  
Old 05-29-2007
vgs vgs is offline
Registered User
  
 

Join Date: May 2007
Posts: 10
i am using sun Solaris.

i am trying to write a script which will display files from a particular folder(Directory)(should not include subdirectories) which are 2 hrs(this should be used like a variable so that i can change the time) older.

i tried using find command. but find looks in subdirectories also. I don't want to check in subdirectories.

files looks like:
12345600000.PDF
32455664647.XLS

appriciate your help.
  #7 (permalink)  
Old 05-29-2007
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
use prune option with find
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:02 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0