file listings by date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting file listings by date
# 1  
Old 11-22-2004
Question file listings by date

Hi all,

First post, be gentle Smilie

OK I'm trying to list all files in a directory that are between x days and y days old, where I need to treat days as being from 00:00 to 23:59. i.e. a list of all files between 1 day and 8 days old would include all files between 00:00 8 days ago and 23:59 1 day ago.

I've had a look through the various FAQ pages (Some nice work there by the way) and done a few searches, but either my specific question hasn't been answered, or I've just not managed to find the right keywords to search with yet.

I've tried using find...

find . -mtime +0 -mtime -8 \( ! -name . -prune \)

But the problem with 'find' is that -8 etc. actually means 8 literal days (as in 8x24hrs) and not 8 days (as in a day being from 00:00 - 23:59).

I could use this if it was going to be in a cron job, but it would have to run the 'find' command at exactly 00:00 to work. But I need to be able to run this at any time of the day.

Is there an alternate to find that works in whole days instead?

Cheers,
Boothy.
# 2  
Old 11-22-2004
try:
Code:
touch  -t 200411180000.01 earlyfile
touch  -t 200411182359.59 latefile
find . -newer earlyfile  ! -newer latefile -print

The "! -newer" means "not newer"
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to determine Date,TotalFile,total size of file based on date

I have file listed like below -rw-r--r--+ 1 test test 17M Nov 26 14:43 test1.gz -rw-r--r--+ 1 test test 0 Nov 26 14:44 test2.gz -rw-r--r--+ 1 test test 0 Nov 27 10:41 test3.gz -rw-r--r--+ 1 test test 244K Nov 27 10:41 test4.gz -rw-r--r--+ 1 test test 17M Nov 27 10:41 test5.gz I... (5 Replies)
Discussion started by: krish2014
5 Replies

2. UNIX for Dummies Questions & Answers

How to pick the latest file with date as one among the file name.( not exactly present date.)?

i have files like 1)20131112_abc_01.csv and 2)20131113_abc_01.csv and 3)20131113_abc_02.csv when i try to fetch the file in the next day. it shud pick the third file.. plz help me.. and i use `date +"%Y%m%d"` command to fetch..it fetches the current date... (2 Replies)
Discussion started by: applepie
2 Replies

3. UNIX for Dummies Questions & Answers

Delete a row from a file if one column containing a date is greater than the current system date

Hello gurus, I am hoping someone can help me with the required code/script to make this work. I have the following file with records starting at line 4: NETW~US60~000000000013220694~002~~IT~USD~2.24~20110201~99991231~01~01~20101104~... (4 Replies)
Discussion started by: chumsky
4 Replies

4. HP-UX

kernel param listings

Which shows the current kernel settings accurately? kmtune or sysdef. I ask because although some params show the same setting with both, some do not. Example >kmtune | grep nfile nfile 75008 - (15*NPROC+2048) >sysdef | grep nfile nfile 75018 ... (6 Replies)
Discussion started by: theninja
6 Replies

5. Shell Programming and Scripting

displaying 3 directory listings in 3 separate columns.

i having problems figuring out how to 'read' in 3 different directory listings and then display them on the screen into 3 separate columns. i thought i could use a 'for' loop to grab each directory and then assign a unique variable to each line 'read' in. of course, as you experts all know,... (16 Replies)
Discussion started by: mjays
16 Replies

6. Programming

Fingerlines in GCC Listings

I recently moved from an AIX to a Linux environment, currently using GCC. I've searched the manpages, to no avail on this one. Q: Does gcc have an option to include finger lines in the listing? In other words, the equivalent compile option for AIX's -qsource and -qsrcmsg? If you don't know... (1 Reply)
Discussion started by: marcus121
1 Replies

7. Solaris

listings file of a package

Hi, Is there a command to list all files within an installed package ? A command to print out a file's package owner ? I have trouble to install a temporary license for FTAM and OSI 9.0 on my sunfire280r and i suspect the licensing software is the reason... Any SUN guru out there ? Thanks (4 Replies)
Discussion started by: andryk
4 Replies

8. Programming

Listings of the games for Linux

Hello! I need tne listings of the very simple games(like mad builders or snake) in text mode, when is running only bash. If you got one, please send me on e-mail or post it just in this thread. I also need the following programms, if you have one of them or can quickly write it, please help me: 1)... (4 Replies)
Discussion started by: Studenttt
4 Replies

9. Programming

sites with the listings

Is anybody know sites with the listings of simple programs for Linux (in text mode) (0 Replies)
Discussion started by: Studenttt
0 Replies
Login or Register to Ask a Question