Find files with specific time


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find files with specific time
# 1  
Old 08-20-2008
Data Find files with specific time

Hi All,

I am in trouble now...

i have two directories..

one can consider as folder-A where processed files are there.

and another one folder-B where i have the corresponding output files..

here ..let say some records may have multiple entrys like below..

/folder-A/

grep -l recordvalue *.csv

-rw-rw-r-- 1 fold ora 2560 Jun 11 09:51 file1.csv
-rw-rw-r-- 1 fold ora 2560 Jun 13 09:51 file2.csv

and there should be an corresponding output in folder-B also..
like below.

/folder-B/

grep -l reocrdvalue *.csv

-rw-rw-r-- 1 fold ora 2560 Jun 11 09:51 file1-output.csv
-rw-rw-r-- 1 fold ora 2560 Jun 13 09:51 file2-output.csv

here my issue is how can i find out recent files in folder-A and the corresponding output status..

ls -lrt | grep -l recordvalue *.csv | tail -1

but there could be possiblity that in output folder-B only one entry might be there ..in that case is there any way i can find out the exact outputs using timestamp...?

pls..help me..

Thanks
Sha
# 2  
Old 08-20-2008
Finding recnt files

find / -atime 2 -print

This command finds files accessed two day ago (the day before yesterday). An additional + and - (minus) can also be used here for greater than and less than.

find / -atime +30 -print

This prints files that have not been accessed in the last 30 days. The find search criteria can be combined. The following command will locate and list all files that were last accessed more than 100 days ago, and whose size exceeds 500,000 bytes.

find / -atime +100 -size +500000c -print

Hope this will help ur query?

Thanks
Brahma
# 3  
Old 08-20-2008
Finding recent files

find / -atime 2 -print

This command finds files accessed two day ago (the day before yesterday). An additional + and - (minus) can also be used here for greater than and less than.

find / -atime +30 -print

This prints files that have not been accessed in the last 30 days. The find search criteria can be combined. The following command will locate and list all files that were last accessed more than 100 days ago, and whose size exceeds 500,000 bytes.

find / -atime +100 -size +500000c -print

Hope this will help ur query?

Thanks
Brahma
# 4  
Old 08-20-2008
Data

Hi ,

Thanks a lot for your quick replay..

here i need to put one more condition..

mean what if there are two entrys contineously like below..
/folder-A/

-rw-rw-r-- 1 fold ora 2560 Jun 11 09:51 file1.csv
-rw-rw-r-- 1 fold ora 2560 Jun 12 09:51 file2.csv

but if the output folder contain only for Jun 11th output..
/folder-B/
-rw-rw-r-- 1 fold ora 2560 Jun 11 09:51 file1.csv
no entry for June 12th..

the above scenario..i should get output something like...

"sorry that particular date there is no output plx raise an issue"

like this..

so for this scenario..
can you help me..


Thanks
Sha
# 5  
Old 08-20-2008
Write the filenames of both input and output to files and use sort and comm -23 command

grep -l recordvalue *.csv | sort > file1
grep -l recordvalue *.csv | awk '{gsub(/-output/,"");print}' | sort > file2
comm -23 file1 file2

P.S. :- Use nawk for Solaris.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Find files in specific folders

Hi Team, I am new to the linux commands and I really need help . I would be really thankful if I can get some inputs. I have below folders in the path "/home/temp" 20170428 20170427 20170429 changes tempI need to get the files generated in the last 15 mins in all the above folders... (4 Replies)
Discussion started by: JackJinu
4 Replies

2. Shell Programming and Scripting

Files created on specific time

Hello Gurus, I am facing one issue to get a file for a specific time. There are about 300 files created between 6.30 pm to 7.15 pm everyday. Now I wanted only the file which is created on 6.45pm. No other files required. I have used "find" command to get the files, but not getting the expected... (3 Replies)
Discussion started by: pokhraj_d
3 Replies

3. Shell Programming and Scripting

Find files for a specific date

Hi, I am looking to find files of a specific date. I am on Sun Solaris so newermt doesnot work.. I thought of using mtime but not getting how to use it. Please help me with this.. Regards Abhinav (3 Replies)
Discussion started by: abhi1988sri
3 Replies

4. Shell Programming and Scripting

Find files with specific date

Dear all, kindly i have some files with different dates i need to grep word from these files but i need to search in files with date 2012-12-02 not all files in this directory do u have any command (4 Replies)
Discussion started by: maxim42
4 Replies

5. Shell Programming and Scripting

Find files that do not match specific patterns

Hi all, I have been searching online to find the answer for getting a list of files that do not match certain criteria but have been unsuccessful. I have a directory that has many jpg files. What I need to do is get a list of the files that do not match both of the following patterns (I have... (21 Replies)
Discussion started by: nikos-koutax
21 Replies

6. Solaris

Find files contains specific line

Hi, I need a command that could search the specified directory (and its sub directories) and file contents. In the result display path of the file and string The command: find <search_dir> -exec grep <search_string> {} \; works but doesn't show the file name Thanks (2 Replies)
Discussion started by: Mack1982
2 Replies

7. Shell Programming and Scripting

How to find a specific files in a many directory

Dear All, Appreciate some help here. I have a log of report. It located in several directory as below: Directory: mysscpr1 mysscpr2 mysscpr3 my_scnpr4 In the directory it contain hundred of files. i need to find a specific files that contain 'invc2345' in the directory. How... (7 Replies)
Discussion started by: selamba_warrior
7 Replies

8. AIX

find files with specific date and time

Hi, I wanna to find files with specific date and time. I know this command: ls -ltr /system1/*.505 | grep 'Jan 18 09:00'. I want the 'Jan 18 09:00' not hard coded, I want it coming from the system date and time. And I want the time varies from 09:00-09:05. Is this possible without heavy... (3 Replies)
Discussion started by: itik
3 Replies

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

10. UNIX for Advanced & Expert Users

find files modified in a specific month

hello i need a way to list files modified in a specific month and move them to a specific directry , i mean somthing like : find . -modifiedtime "May" -print -exec /usr/bin/mv newdirectory thank u (1 Reply)
Discussion started by: omer_ome
1 Replies
Login or Register to Ask a Question