The UNIX and Linux Forums  


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
finding the file which is modified within last 2 hours trichyselva Shell Programming and Scripting 5 06-04-2009 02:53 PM
How to list files that were added or modified on a certain date? thoughts UNIX for Dummies Questions & Answers 8 02-20-2008 01:44 AM
Create a list of files that were modified after a given date. rkka UNIX for Dummies Questions & Answers 4 01-22-2008 05:12 AM
Finding list of modified files for a particular time duration sanajyg_mnit SUN Solaris 2 02-13-2007 03:48 AM
How do I get the last modified date of a file? akpopa UNIX for Dummies Questions & Answers 2 08-29-2001 04:08 PM

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

Join Date: Dec 2007
Posts: 41
Finding modified File List after the chosen date in Korne Shell...

I am trying to write a Korne Shell asking the user for a date and a directory and then search recursively in this directory the list of files modified after the date chosen. But I am not getting good results when I Test it...

#!/usr/bin/ksh
echo "Enter a date (YYYYMMDD) "
read date
touch -t 00000000 /tmp/timestamp
echo "Enter a directory.."
read dir
find "$dir" -type f -newer /tmp/timestamp


I earlier used -mtime, but it should not be used, as -mtime searches for files older by no. of days and not for files modified after a particular date.

Can anyone please provide with some pointers to my above Code wrt the mistakes that I did..

Thanks a lot in advance... :-))
  #2 (permalink)  
Old 12-07-2007
denn denn is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 96
a few issues:

you're asking user to input a date, you then read that date, however after that, you don't reference this input anywhere. shouldn't you be using this for your touch command, instead of: touch -t 00000000 /tmp/timestamp ?

The touch command you have doesn't work, at least here on any of my versions of UNIX.

touch require not only a date, but hrs/mins, so you'll need to reformat input from the read: from the man page:
format is YYMMDDhhmm

touch -t 8907140000 bastille
/tmp $ ll bastille
-rw-r--r-- 1 root sys 0 Jul 14 1989 bastille
  #3 (permalink)  
Old 01-22-2008
rkka rkka is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 5
i think -mtime should do the job. becuase if u did not modify/change a file in the specified period it wont show up.

find . -type f -mtime -7 -print

this shows a list of all files that were modified within the last 7 days.
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 10:43 AM.


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