List of Files which are Greater then a specific date


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers List of Files which are Greater then a specific date
# 1  
Old 03-06-2012
List of Files which are Greater then a specific date

A newbie question...

I need to get a list of the Files and folders which are greater then a specific date. I want write the output to a Text file.

What I know
PHP Code:
ls -lrt 
gives me list of all the files ordered by date. Also
PHP Code:
ls fileName 
will write the results to a text file.

Please help
# 2  
Old 03-06-2012
One trick to doing this is to create a file of the right date and find files newer than it.

Code:
touch -t YYYYMMDDhhmmss /tmp/$$
find /path/to/folder -type f -newer /tmp/$$
rm -f /tmp/$$

If you meant greater as in older, then '!' -newer /tmp/$$
# 3  
Old 03-06-2012
Code:
cd /directory/you/want
# touch -t [specific date does here as YYYYMMDD0000]
# example for march 5 2012 at midnight
touch -t 201203050000 dummy
# complete listing with dates so you can verify file dates
find .  -newer dummy -exec ls -l > textfile
# just filenames
find .  -newer dummy > short_textfile

# 4  
Old 03-06-2012
Quote:
Originally Posted by jim mcnamara
Code:
# complete listing with dates so you can verify file dates
find .  -newer dummy -exec ls -l > textfile

I am getting the following error when I run the above find command.

find: 0652-018 An expression term lacks a required parameter.
# 5  
Old 03-06-2012
What's your system?
# 6  
Old 03-07-2012
Quote:
Originally Posted by Corona688
What's your system?
I think it is AIX Version 6.1
# 7  
Old 03-07-2012
Hmm. If it doesn't have -newer that's annoying, but you can kludge around that by using flags in the shell.

Code:
find . -type f |
while read LINE
do
        [ "$LINE" -nt dummy ] && echo "$LINE is newer than dummy"
done

Unfortunately this isn't as efficient.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to list files that are not first two files date & last file date for every month-year?

Hi All, I need to find all files other than first two files dates & last file date for month and month/year wise list. lets say there are following files in directory Mar 19 2012 c.txt Mar 19 2012 cc.txt Mar 21 2012 d.txt Mar 22 2012 f.txt Mar 24 2012 h.txt Mar 25 2012 w.txt Feb 12... (2 Replies)
Discussion started by: Makarand Dodmis
2 Replies

2. Shell Programming and Scripting

Please help list/find files greater 1G move to different directory

I have have 6 empty directory below. I would like write bash scipt if any files less "1000000000" bytes then move to "/export/home/mytmp/final" folder first and any files greater than "1000000000" bytes then move to final1, final2, final3, final4, final4, final5 and that depend see how many files,... (6 Replies)
Discussion started by: dotran
6 Replies

3. UNIX for Dummies Questions & Answers

Want to get list of Linux commands used on specific date through HISTORY command

I want to get list of linux commands used on Jan 01 2014 with the help of HISTORY command or some other linux commands,. Kindly help. (3 Replies)
Discussion started by: karthick nath
3 Replies

4. Shell Programming and Scripting

Find files greater than a particular date in filename.

I need a unix command which will find all the files greater that a particular date in the file name. say for example I have files like(filenaming cov : filename.YYDDMMSSSS.txt) abc.201206015423.txt abc.201207013456.txt abc.201202011234.txt abc.201201024321.txt efg.201202011234.txt... (11 Replies)
Discussion started by: lijjumathew
11 Replies

5. 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

6. Shell Programming and Scripting

Deleting specific rows in large files having rows greater than 100000

Hi Guys, I need help in modifying a large text file containing more than 1-2 lakh rows of data using unix commands. I am quite new to the unix language the text file contains data in a pipe delimited format sdfsdfs sdfsdfsd START_ROW sdfsd|sdfsdfsd|sdfsdfasdf|sdfsadf|sdfasdf... (9 Replies)
Discussion started by: manish2009
9 Replies

7. Filesystems, Disks and Memory

How to list files with specific created date

Hi, Would like to ask, which command is used to list all the files for specific date (says 1st May) and its size, for all files (including its subdirectory), in a mounted NFS disk to HP-UX. I would like to check for the total files came into my disk on 1st May. Very much appreciating your... (2 Replies)
Discussion started by: Draculla
2 Replies

8. Shell Programming and Scripting

List files created between specific date and time

Hi I need to write a script to list files in a directory created within specific date and time for eg list files created between Apr 25 2007 11:00 to Apr 26 2007 18:00. and then i have to count them Any suggestions pls ? (3 Replies)
Discussion started by: jazjit
3 Replies

9. Solaris

List files with a specific date...

Hi all, thanks in advance for reading and anyposts... I was wondering if its possible to find all files in a directory with a specific date. I know I can do: but that will only give a list of files greater than todays date... Any ideas? Thanks, Marky Mark... (4 Replies)
Discussion started by: B14speedfreak
4 Replies

10. Shell Programming and Scripting

Deleting specific files greater then 90 days

I have a directory that contains a number of history files for a process. Every file starts with the string "EVACK". FOr example EVACK0101.000001 EVACK0102.095940 EVACKmmdd.hhmiss I want to erase in the specific directory ONLY(no sub-directories) all EVACK files older then 90 days. I... (2 Replies)
Discussion started by: beilstwh
2 Replies
Login or Register to Ask a Question