Script to check file with previous date


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script to check file with previous date
# 1  
Old 02-17-2011
Script to check file with previous date

Hi all,I need your help to create the script.I need a script to check the ZIP file at network location with yesterday date name. ZIP file creation date is current date, but name of the zip file is previous date. for example file name "20110216.zip" created today 201102017.I just want to return the yes or no value or any thing work;sPlease ReplyThanksDeepak Singla
# 2  
Old 02-17-2011
Quote:
Originally Posted by deepaksingla
...ZIP file creation date is current date, but name of the zip file is previous date. for example file name "20110216.zip" created today 201102017.I just want to return the yes or no value ...

If you have GNU date in Bash shell, then -

Code:
if [ -e "`date -d'yesterday' '+%Y%m%d'`.zip" ]; then
 echo "Yes, file exists"
else
 echo "No, file does not exist"
fi

tyler-durden
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

AIX UNIX - script on how to extract from log file with previous date

Hello, I am new to this forum so any assistance would help. I am currently trying to develop a script that extract all data from a log file with has the previous day's date. $ <root@aixtest3> /var/log > more sudo.log May 13 10:52:10 aixtest3 local2:notice sudo: tbrath : TTY=unknown ; ... (14 Replies)
Discussion started by: Kslew82
14 Replies

2. Shell Programming and Scripting

Script to get previous date for the given input date..

hi all, need a script or command to get the previous date for the given input date... like in my script i will pass date as input parameter like 2014-12-01 and i want the output as previous date.. ie.. 2014-11-30 (2 Replies)
Discussion started by: hemanthsaikumar
2 Replies

3. UNIX for Dummies Questions & Answers

Help in script to check file name with todays date

I am trying to include a snippet in my script to check if the file created is having today's date. eg: File name is : ABC.YYYYMMDD-nnn.log The script should check if 'YYYYMMDD' in the above file name matches with today's date. Can you please help me in achieving this. Thanks in advance!! (5 Replies)
Discussion started by: kiran1112
5 Replies

4. Shell Programming and Scripting

finding the previous day date and creating a file with date

Hi guys, I had a scenario... 1. I had to get the previous days date in yyyymmdd format 2. i had to create a file with Date inthe format yyyymmdd.txt format both are different thanks guys in advance.. (4 Replies)
Discussion started by: apple2685
4 Replies

5. Shell Programming and Scripting

check log for previous date

Hi, i want to check the log for previous date. For getting today's log I have written the script result=tot_max_`date+%y%m%d`.log Pls can anyone help on how to get for previous date. Thanks in Advance, Neha. (5 Replies)
Discussion started by: NehaKrish
5 Replies

6. Shell Programming and Scripting

Perl Script to check file date and size

Hi guys, i am new to perl. I started reading the perl documents and try to come up with some logic. I am trying to create a script that would go into a location, search for todays files, then searches for all .txt files from today. If todays not found, its an error If file size is less... (26 Replies)
Discussion started by: DallasT
26 Replies

7. Shell Programming and Scripting

write script for previous date

Hi all, I need to write a unix shell script that will return the previous date of date entered and i have to consider leap year also. For eg:- if i entered 2009-08-18 then the script should return 2009-08-17 can you please help me to write this... (12 Replies)
Discussion started by: prasson_ibm
12 Replies

8. Shell Programming and Scripting

Check File Exists and compare to previous day file script

We have data files that are ftp'd every morning to a SUN server. The file names are exactly the same except for that each has the date included in its name. I have to write script to do 2 things: STEP 1) Verify that the file arrived in morning. STEP 2) Compare the file size of the current... (3 Replies)
Discussion started by: rbknisely
3 Replies

9. Shell Programming and Scripting

Specify a previous date as start date in shell script

Hi, I am trying to modify a script which accepts date in format dd/mm/yy. I am trying to modify the script so that it retrieves the date that was 15 days earlier from today as start date. Eg.if today is 05/09/2006, the script should retrieve 21/08/2006 as start date. Is there any script/code to... (2 Replies)
Discussion started by: ritzwan0
2 Replies

10. UNIX for Dummies Questions & Answers

file date check script

I am creating a KSH script and need to check the filedate against the system date. I can get the sys date w. date command, and I was able to get the filedate w. the awk command but when I compare them w. an if condition statement I get syntax error. Not sure what's wrong, and other suggestions on... (4 Replies)
Discussion started by: jaxconsultant
4 Replies
Login or Register to Ask a Question