LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-31-2010, 12:15 AM   #1
Pawang
LQ Newbie
 
Registered: Jun 2009
Posts: 11

Rep: Reputation: 0
Post need help - script to display modified date&time of files


Hi,

I am using the following script to creates list of accessed files.I like to add modified date and time of accessed files in the output.

For this what needs to be added in the below script??

Any help..Thanks in advance.

#!/bin/bash
#
# creates list of accessed files
#
set $(date)
find /hdc160GB/programmers/projects -cmin -1440 > /hdc160GB/programmers/data/fileschanged/alert_$6-$2-$3.txt
 
Old 05-31-2010, 12:41 AM   #2
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
homework? - but with honest attempt so it is OK... consider

-cmin -$time looks for files created $time minutes ago - don't you want -mmin -$time

Hint: what does this do?

find $search-dir -name $sought-file -printf %t

Last edited by Simon Bridge; 05-31-2010 at 12:45 AM.
 
Old 05-31-2010, 05:35 AM   #3
Pawang
LQ Newbie
 
Registered: Jun 2009
Posts: 11

Original Poster
Rep: Reputation: 0
Thanks for your reply.

I got the solution i just added (-ls) to my script to print the modified date and time against each file in log.

This script is to log list of modified files in last 24 hours.

#!/bin/bash
#
# creates list of accessed files
#
set $(date)
find /hdc160GB/programmers/projects -cmin -1440 -ls > /hdc160GB/programmers/data/fileschanged/alert_$6-$2-$3.txt
 
Old 06-01-2010, 02:40 AM   #4
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
Well done - it is usually a matter of hunting through the options.
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] how do i log the start/completion (time&date) of my cron job script? davide123 Linux - Newbie 3 01-11-2010 06:25 PM
cat file with its modified date n time coolplanet Programming 7 10-25-2009 08:44 PM
shell script to find modified date and last accessed date of any file. parasdua Linux - Newbie 6 04-22-2008 09:59 AM
Where can I look for the config file for modified date and time ForumKid Linux - General 1 09-19-2003 08:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration