How to search files by time in this directory


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to search files by time in this directory
# 1  
Old 01-21-2014
How to search files by time in this directory

Hello dears,

In my home directory (msc-loader) there are some files like this:

Code:
[root@msc-loader /]# ls -l
-rwxrwxrwx 1 user dba 1680318 Jan 20 13:32 103386_s.c
-rwxrwxrwx 1 user dba  256743 Jan 20 13:37 103387_o.c
-rwxrwxrwx 1 user dba 1635363 Jan 20 13:39 103387_s.c
-rwxrwxrwx 1 user dba  264735 Jan 20 13:41 103388_o.c
-rwxrwxrwx 1 user dba 1613385 Jan 20 14:38 103388_s.c
-rwxrwxrwx 1 user dba  283716 Jan 20 14:41 103389_o.c
-rwxrwxrwx 1 user dba 1528470 Jan 20 14:55 103389_s.c
-rwxrwxrwx 1 user dba  257742 Jan 20 15:39 103390_o.c
-rwxrwxrwx 1 user dba 1614384 Jan 20 15:41 103390_s.c
-rwxrwxrwx 1 user dba  257742 Jan 20 15:42 103391_o.c
-rwxrwxrwx 1 user dba 1673325 Jan 20 15:44 103391_s.c
-rwxrwxrwx 1 user dba 1680318 Jan 20 16:32 103386_s.c
-rwxrwxrwx 1 user dba  256743 Jan 20 16:37 103387_o.c
-rwxrwxrwx 1 user dba 1635363 Jan 20 16:39 103387_s.c
-rwxrwxrwx 1 user dba  264735 Jan 20 17:41 103388_o.c
-rwxrwxrwx 1 user dba 1613385 Jan 20 17:38 103388_s.c
-rwxrwxrwx 1 user dba  283716 Jan 20 17:41 103389_o.c
-rwxrwxrwx 1 user dba 1528470 Jan 20 17:55 103389_s.c
-rwxrwxrwx 1 user dba  257742 Jan 20 17:39 103390_o.c
-rwxrwxrwx 1 user dba 1614384 Jan 20 18:41 103390_s.c
-rwxrwxrwx 1 user dba  257742 Jan 20 18:42 103391_o.c
-rwxrwxrwx 1 user dba 1673325 Jan 20 18:44 103391_s.c

As you see, the files are created between the time [13:32] until [18:44]
ok?
Now, I need to search files that created between [16:37] until [18:42]

How can I make this search using [find] command?! Smilie

Waiting your answer, many thanks.
# 2  
Old 01-21-2014
This highly depends on your find's version, which you fail to mention. If it happens to be GNU find, the -newerXY test may be available. In other versions, you may need to touch two files with your starting and ending times, respectively, and then compare against those with the -newer test.

Last edited by RudiC; 01-21-2014 at 09:15 AM.. Reason: typo
# 3  
Old 01-21-2014
Thanks RudiC
Yes, it is an old version.
So, can you please give me an example, to find files that created between [16:37] until [18:42]
# 4  
Old 01-21-2014
If you read man find and man touch and come up with a proposal yourself, I'm happy to discuss whatever should not work.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search Files on a given path based on latest time stamp

find /app/data -name "Availability" - Below is the output now i need to filter based on latest modified timestamp. I know 3 is the latest modified time stamp but i tried different options but only filtering docs and not on headnote..Can any one tell me how to do that.. ... (2 Replies)
Discussion started by: vkiyv05
2 Replies

2. UNIX for Advanced & Expert Users

Need to search for keywords within files modified at a certain time

I have a huge list of files in an Unix directory (around 10000 files). I need to be able to search for a certain keyword only within files that are modified between certain date and time, say for e.g 2012-08-20 12:30 to 2012-08-20 12:40 Can someone let me know what would be the fastest way... (10 Replies)
Discussion started by: virtual123
10 Replies

3. Shell Programming and Scripting

Search a directory for files that contain pathnames

Hello, I really don't know if this is possible, but I figured the wonderful users of unix.com may be able to provide me with some help/suggestions. I want to create a (bash) script that would go will accept an input file. That input file contains important information as well as pathnames. For... (4 Replies)
Discussion started by: tester213
4 Replies

4. UNIX for Dummies Questions & Answers

How to search all the files in a directory for a specific string

Hi Guys, I want to search the content of all the files (of a particular type like .txt) in a directory for a specific string pattern. Can anyone help me? Thanks (7 Replies)
Discussion started by: mwrg
7 Replies

5. UNIX for Dummies Questions & Answers

Search for a text within files in a directory

I need to search for a particular string. This string might be present in many files. The directory in which I am present has more than one subdirectories. Hence, the search should check in all the subdirectories and all the corresponding files and give a list of files which have the particular... (5 Replies)
Discussion started by: pakspan
5 Replies

6. Shell Programming and Scripting

search files in a directory and its subdirectories

Hello my friends, I need to write a simple shell bad file :D that search and delete a file it's name 'Microsoft.txt' in the current directory and its subdirectories? So can you help to guide me how i can write this shell, Just give me the beginning :o thank you. (1 Reply)
Discussion started by: Net-Man
1 Replies

7. UNIX for Dummies Questions & Answers

How to search for files based on the time stamp

Hi All, I know the timestamp of a file. Now i would like to list all the files in the with the same time stamp in the same file. Any help would be appreciated. Thanks. sunny (1 Reply)
Discussion started by: sunny_03
1 Replies

8. UNIX for Dummies Questions & Answers

search for certain word in a files from directory

hi can i know how to get the file name of any files containing for example "abc" from a number of files in a directory? i tried "ls -ltrc | grep abc" but no resulted generated. thanks in advance. (1 Reply)
Discussion started by: legato
1 Replies

9. Shell Programming and Scripting

search all files and sub directory

I wanted to search in all the sub directories under /vob/project (recurse) in everything inside /vob/project. search.run for x in `cat search.strings` do find /vob/project -type f -print | xargs grep -i $x > ~/$x.txt done search.string hello whoami I am getting the error ... (5 Replies)
Discussion started by: siva_jm
5 Replies
Login or Register to Ask a Question