find files for next day of the date entered


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting find files for next day of the date entered
# 1  
Old 11-11-2011
find files for next day of the date entered

i have few files generated everyday with a date stamp. Sometimes it happens that if the files are generated late i.e after 00:00 hrs the date stamp will be of the next day.

example:

110123_file1
110123_file2
110123_file3
110124_file4

in the above example file4 is also for the previous day i.e 23rd(as per example) but its generated after 00:00hrs which results in date stamp for the current day.

i want to copy the files for a specific date to another location but in this case only 3 files will be copied and file4 will be copied for the next day run while file4 is for the previous day.

lets say these files are generated after 20:45hrs everyday. but if there is any delay also the files will be generated within 02:00hrs the next day. so i want to have a check wherein i input the date(23rd for the example above) and it should take all the files generated after 20:45hrs for the date entered even the file4 in this case.

all the files generated will have standard filename along with the date stamp.
# 2  
Old 11-11-2011
what is your app or content of script if it there is?
# 3  
Old 11-11-2011
The easiest way could be get your "limit" file and use find to do your stuff:
Code:
# ll
total 0
-rw-r--r--   1 xxx     x              0 Nov 11 11:50 1.dat
-rw-r--r--   1 xxx     x               0 Nov 11 11:50 2.dat
-rw-r--r--   1 xxx     x               0 Nov 11 11:50 3.dat
-rw-r--r--   1 xxx     x               0 Nov 11 11:50 4.dat

Code:
#find . -type f -newer 1.dat 
./2.dat
./3.dat
./4.dat

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Need to get the next day's date of the user entered date

I need to get the next day's date of the user entered date for example: Enter date (yyyy/mm/yy): 2013/10/08I need to get the next day's date of the user entered date Desired Output: 2013/10/09Though there are ways to achieve this is Linux or Unix environment (date command) ,I need to... (1 Reply)
Discussion started by: rpm120
1 Replies

2. Shell Programming and Scripting

To get the files in a directory for the given date (User entered date)

Need a ksh script to get the files that were created or modified in a directory on a particular date entered by the user. For example if a directory contains files as below : > ll total 41 -rw-rw-r-- 1 psn psn 199 Aug 23 07:06 psn_roll.sh -rw-rw-r-- 1 psn psn ... (10 Replies)
Discussion started by: ramprabhum
10 Replies

3. Shell Programming and Scripting

How to find the date of previous day in shell script?

Hi Experts, i am using the below code get the date of previous day. #!/usr/bin/ksh datestamp=`date '+%Y%m%d'` yest=$((datestamp -1)) echo $yest When i execute the code i am getting output as: 20130715 What i am trying here is, based on the date passed i am fetching previus day's... (0 Replies)
Discussion started by: learner24
0 Replies

4. Shell Programming and Scripting

How to view files from a specific date/day

I wan to view files in a directory of a specific date. For example a log directory has log files . I want to view the list of the files which were generated on 01-May-2011. Is there any option/proces to perform it?? (1 Reply)
Discussion started by: mady135
1 Replies

5. Shell Programming and Scripting

Find files of particular day

Hi, I need to find all files of particular day lets say for 2nd august in below. -rw-r--r-- 1 skl eusdc 8168 Aug 5 19:31 aabc123.txt -rw-r--r-- 1 skl eusdc 4251 Aug 5 19:31 aabc124.txt -rw-r--r-- 1 skl eusdc 4252 Aug 6 19:31 aabc125.txt -rw-r--r-- ... (15 Replies)
Discussion started by: sachinkl
15 Replies

6. HP-UX

To find day out of date in HP-unix

Dear Frends, Could you please help me with the command or option by which I can find day where the input is date(can be of future or past). I do have for linux, However it is not working @ hp unix. Please help. Regards Rahul (4 Replies)
Discussion started by: Rahul chitriv
4 Replies

7. Shell Programming and Scripting

validating user entered date

I need the date validation. I searched in the google but i didn't find my requirements. requirements: 1) user has to enter the date in YYYY/MM/DD format 2) MM validations 3) DD validations. and if the month is april it should allow 30 days only and for May month it should allow 31 days like... (1 Reply)
Discussion started by: KiranKumarKarre
1 Replies

8. Shell Programming and Scripting

find files modified more than a day

Hi All, I am using the below command to check the files modified within last 24hours find /home/karthik -mtime -1 -type f -exec ls -l {} \; What parameter do i need to add in the above command to check the files modified in last 2 or 3 days Kindly let me know if any other alternative... (2 Replies)
Discussion started by: karthikn7974
2 Replies

9. Shell Programming and Scripting

Function to find day of any given date.

Hi, Is there any function in Unix by which v can find the exact day of any given date. Like i need to get Wednesday if i give 05 07 2008 (format MM DD YYYY) Thanks, RRVARMA (5 Replies)
Discussion started by: RRVARMA
5 Replies

10. UNIX for Dummies Questions & Answers

How to find Day of the Week from the given date (Perl)?

How to find the Day of the Week of the given Date using perl? If I have a date in YYY--MM-DD format, how to find the DOW? Based on that, I need to find the following sunday. Pls help. (5 Replies)
Discussion started by: deepakwins
5 Replies
Login or Register to Ask a Question