How to pick only current week files?


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to pick only current week files?
# 1  
Old 05-21-2013
How to pick only current week files?

Hi,

My job will run every friday and it should pick only that week files.
For Ex: this 24th May job will trigger and it should pick 20,21,22,23,24.and 19th sun and 18th sat we dont have files to pick.
currently i am using the below code and it is working fine, but sometimes it is picking the last week file also i.e 17th which results duplicates.

ssh tr_ap@apalyn /usr/bin/find '/apps/trav/decrypt/archive/ApprovedReports*' -mtime -7


Please let me know is there any other way to pick only that week files.
Thanks in advance.
Kiran
# 2  
Old 05-21-2013
Try:
Code:
ssh tr_ap@apalyn /usr/bin/find '/apps/trav/decrypt/archive/ApprovedReports*' -daystart -mtime -7

# 3  
Old 05-21-2013
Hi ,

i executed now using the below code , but it took last week files 16,17,20,21.It should take only 20 and 21st. Please let me know if this code works only on fridays.
ssh tr_ap@apalyn /usr/bin/find '/apps/trav/decrypt/archive/ApprovedReports*' -daystart -mtime -7
# 4  
Old 05-21-2013
Yes, it works only on Fridays.
This User Gave Thanks to bartus11 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Pick up files to process using ls command

Hello All, I have a list of files as below --------- FORM_PTIR_9484_ANFDOP_20150716_00263059.DAT FORM_PTIR_9484_TIFDOP_20150716_00263059.DAT FORM_PTIR_9484_EXFDOP_20150716_00263059.DAT FORM_PTIR_9484_ANFDEX_20150716_00263059.DAT FORM_PTIR_9484_ANFDCA_20150716_00263059.DAT and so on....... (4 Replies)
Discussion started by: rac
4 Replies

2. Shell Programming and Scripting

Can we get Tuesday's date of the current week in UNIX

Hi All, I have a requirement which would calculate the Tuesday's date of the current week in yyyymmdd format in unix shell script. Please help me out how could I do this . I appreciate your help Regards, raj (7 Replies)
Discussion started by: rajeevm
7 Replies

3. Shell Programming and Scripting

How to pick only the files which are generated in one hour?

Hello Masters, I need one help. I want to copy the files which are continuously generating on one server. But this would be on hourly basis. e.g. -rw-rw-r-- 1 akore akore 0 Feb 12 03:20 test1.log -rw-rw-r-- 1 akore akore 0 Feb 12 03:42 test2.log -rw-rw-r-- 1 akore akore 0 Feb 12 04:22... (2 Replies)
Discussion started by: akore83
2 Replies

4. Shell Programming and Scripting

Pick files after specified Time from a folder in Perl

Hi All I am stuck in a problem and wants help What i want to do is I have a directory(say name of that directory is outdir) In that directory(outdir) the files come after some gap of time by some processes. What i want to do is i want to list all the files in that directory after the given... (2 Replies)
Discussion started by: parthmittal2007
2 Replies

5. UNIX for Dummies Questions & Answers

Script to pick the files from source folder

Hi, I wrote a script to pick files based on some logic. when I execute my script, I get the below message ( I bolded the lines in the script where this error message shows up), it says that files are not available and it is a valid scenario if the files are not available and I don't know how... (9 Replies)
Discussion started by: Vijay81
9 Replies

6. UNIX for Dummies Questions & Answers

How to pick only the latest files based on the timestamp?

I have a few log files which get generated on a daily basis..So, I need to pick only the ones which get generated for that particular day. -rw-r--r-- 1 staff 510732676 Apr 7 22:01 test.log040711 -rwxrwxrwx 1 staff 2147482545 Apr 7 21:30 test.log.2 -rwxrwxrwx 1 staff 2147482581 Apr 7 19:26... (43 Replies)
Discussion started by: win4luv
43 Replies

7. UNIX for Dummies Questions & Answers

Can we get every tuesday or monday's date for the current week

Hi Can we get every tuesday or monday's date for the current week ? For the current week i need tuesday's date or monday's date in %m%d%y fromat Thanks (5 Replies)
Discussion started by: laxmi131
5 Replies

8. Shell Programming and Scripting

need to pick out files which are not of zero bytes

I need a scriptto print only those files from a list of files starting with STMT* which are not of zero bytes ...i.e they have some size if these are the files 631 -rw-r--r-- 1 assrisa assrisa 39099 Aug 19 07:16 STMT_05_D1090819_T071320 -rw-r--r-- 1 assrisa assrisa 0 Aug 19... (2 Replies)
Discussion started by: viv1
2 Replies

9. Shell Programming and Scripting

Finding files in current directory when 100,000's files in current directory

Hi All I was wondering what is the most efficient way to find files in the current directory(that may contain 100,000's files), that meets a certain specified file type and of a certain age. I have experimented with the find command in unix but it also searches all sub directories. I have... (2 Replies)
Discussion started by: kewong007
2 Replies

10. Shell Programming and Scripting

Pick the latest set of files

I have task in which I need to pickup a set of files from a directory depending on the following criteria: Every month 6 files are expected to arrive at /test. The files come with date timestamp and the latest file set for the month needs to be used Suppose this is the set of files that present... (5 Replies)
Discussion started by: w020637
5 Replies
Login or Register to Ask a Question