Filter by modify date.


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Filter by modify date.
# 1  
Old 07-29-2007
Filter by modify date.

I want to filter an "ls -al" command so it only shows me files with modify dates older than two weeks. What is the best way of doing this?
# 2  
Old 07-29-2007
Use the find command with the mtime option:

find ./ -mtime + 14 -exec ls -l {}

You might have to tinker with it if there are subdirectories.
# 3  
Old 07-29-2007
Edit: Never mind I got it working


What I'm trying to do is keep track of which of my rsync clients have not synced for two weeks. I have the clients write and entry in a simple log file and it is synced to my rsync server. right now I can do the following to list the log file for each clients rsync.log file. I figured it out using something like below.

find /path/to/backup/*/rsync.log -mtime +14 -exec ls -l {} \;

Last edited by millerdc; 07-29-2007 at 10:55 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Linux

Filter log file contents between date

Hi, Could you please provide me command to filter contents between date in a log file? Say for example, in a log file I want to capture contents between date May 01 from 5am to 9 am. OS -- Linux Regards, Maddy (1 Reply)
Discussion started by: Maddy123
1 Replies

2. Shell Programming and Scripting

Question on sync 2 folders with checking files' modify date

Hi Linux Community I would like to ask about how to compare files in deferent server with date. Those A and B servers has the same folder, I have write a sample script to "ls" both folders and "diff" them, and then "rsync" the missing files. It was running well, both A and B are sync, until... (2 Replies)
Discussion started by: lunaticdawn
2 Replies

3. Shell Programming and Scripting

How to filter date input in awk?

Hi, I've no problems filtering text in awk but whenever I try to filter date format such as 03022013, I couldn't get awk to filter the item out. Any tips? (8 Replies)
Discussion started by: commonwealth
8 Replies

4. Shell Programming and Scripting

Date capture & filter

Dear All, I am capturing system date and creating the file by using that time stamp, file is getting appended with checks of application & database check logs. But when the date is in between 1 to 9 both inclusive, it appends a single space to file name but after 9th it works fine. ... (5 Replies)
Discussion started by: pradeep84in
5 Replies

5. Shell Programming and Scripting

Script to filter by date

Hello, I currently have the need to perform backup, naming the file by date. How do I get the script, you can choose the most current file or current date and then upload it? My script is related to this topic that is already closed. Read Post Can anyone help me? (12 Replies)
Discussion started by: hdegenaro
12 Replies

6. Shell Programming and Scripting

how to filter file for specific date

Hi My OS is solaris 64 bit 10, I have many files in a logs directory where we recive 40-50 logs every day. i have last 20 days file present in this directory. I want to move each day file to a particulaar directory whose name is appended with the date of file. eg Code: 1.txt file... (1 Reply)
Discussion started by: guddu_12
1 Replies

7. Shell Programming and Scripting

need to modify code for catching last date from file

Hi All, I am having one abc.txt file contains below data. abc.txt contains below data jjhj "TransactTime":"2011-09-26 12:09:15" ggjk "TransactTime":"2011-10-31 12:09:15" jlajsla "TransactTime":"2011-11-01 12:09:15" in below code using " $runDate = $1 if $str =~... (2 Replies)
Discussion started by: aish11
2 Replies

8. Shell Programming and Scripting

Trying to modify a print filter!

Ok, the filter looks like this. awk ' BEGIN{printf ("^ This is sending escape sequences to the printer. What I also would like to do is filter out certain pages. I only want the contant between two markers. Start Marker=1Q2Q3Q4Q, End Marker=5Q6Q7Q8Q. I also need the actual line that... (0 Replies)
Discussion started by: djsal
0 Replies

9. UNIX for Dummies Questions & Answers

ftp by date filter

i would be grateful if someone could supply me with a shell script which performed a ftp but only retrieved files which had a created date greater than a specific date - is this possible with ftp? many thanks mc (1 Reply)
Discussion started by: campbem
1 Replies

10. UNIX for Dummies Questions & Answers

modify date of a file

I'm trying to find a way to print the date that a file was modified on. Using ls -l gives me to much information! All i need is the date. There must be a simple way to do this, but i cannot find it anywhere.. can someone give me some advise? (2 Replies)
Discussion started by: tine
2 Replies
Login or Register to Ask a Question