05-25-2011
Script to check if last modified day is previous day
Hi,
I would like to write a script that checks if a file ('counter') was modified the previous day, if so erase its contents and write 00000000 into it.
For e.g. if the file 'counter' was last modified at 11.30pm on 24th May and the script runs at 12.15am of 25th May, it should erase it's contents and write 00000000 into it.
I know it's not a great question but apologies, I'm new to unix and shell scripting.
Thanks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi ,
I am relatively new to unix...
Can u pls help me out to find out if the first day of the month is a working day ie from (Monday to Friday)...using Date and If clause in Korn shell..
This is very urgent.
Thanks for ur help... (7 Replies)
Discussion started by: phani
7 Replies
2. Shell Programming and Scripting
Hello,
Can you please help me how do i get previous and next working day of the week for a given date excluding saturday and sunday.
Ex: if the given date is monday, i should get friday and tuesday's date
if the given date is friday, i should get thrusday and monday's date.
Thanks,... (4 Replies)
Discussion started by: kotasateesh
4 Replies
3. Shell Programming and Scripting
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
4. Shell Programming and Scripting
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
5. UNIX for Dummies Questions & Answers
hi all.
Please help me with archiving previous day syslog files.
the files have no extension and have the format YYYY-MM-DD.
I want to archive the file then move it to some other machine.
thanks. (2 Replies)
Discussion started by: coolatt
2 Replies
6. Shell Programming and Scripting
Hi All,
I need to find the previous month last day minus one day, using shell script. Can you guys help me to do this.
My Requirment is as below:
Input for me will be 2000909(YYYYMM)
I need the previous months last day minus 1 day timestamp. That is i need 2000908 months last day minus ... (3 Replies)
Discussion started by: girish.raos
3 Replies
7. Shell Programming and Scripting
Hi,
i am developing a script for my project. In my script i need to check some conditions based upon some values. in that one value is the previous date. with the previous date i need to check and process some values. I have a function with me retrieve the yesterdays date.
But now i have a... (6 Replies)
Discussion started by: intiraju
6 Replies
8. UNIX for Dummies Questions & Answers
Hi All,
I have a requirement where I need to first capture the current day & move all the files from a particular directory based on a previous day.
i.e move all the files from one directory to another based on current day & a previous day. Here is what I am trying, but it gives me errors.... (2 Replies)
Discussion started by: dsfreddie
2 Replies
9. Shell Programming and Scripting
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
10. Shell Programming and Scripting
How to check the day name,is it saturday in bash shell script.
If dayname = saturday then
run the full load
else
run just the incremental loads
end if
Thank you very much for the helpful information. (4 Replies)
Discussion started by: cplusplus1
4 Replies
LEARN ABOUT REDHAT
tiffwritedirectory
TIFFWriteDirectory(3T) TIFFWriteDirectory(3T)
NAME
TIFFWriteDirectory, TIFFRewriteDirectory - write the current directory in an open TIFF file
SYNOPSIS
#include <tiffio.h>
int TIFFWriteDirectory(TIFF* tif)
int TIFFRewriteDirectory(TIFF* tif)
DESCRIPTION
TIFFWriteDirectory will write the contents of the current directory to the file and setup to create a new subfile in the same file. Appli-
cations only need to call TIFFWriteDirectory when writing multiple subfiles to a single TIFF file. TIFFWriteDirectory is automatically
called by TIFFClose and TIFFFlush to write a modified directory if the file is open for writing.
The TIFFRewriteDirectory function operates similarly to TIFFWriteDirectory but can be called with directories previously read or written
that already have an established location in the file. It will rewrite the directory, but instead of place it at it's old location (as
TIFFWriteDirectory would) it will place them at the end of the file, correcting the pointer from the preceeding directory or file header to
point to it's new location. This is particularly important in cases where the size of the directory and pointed to data has grown, so it
won't fit in the space available at the old location.
RETURN VALUES
1 is returned when the contents are successfully written to the file. Otherwise, 0 is returned if an error was encountered when writing
the directory contents.
DIAGNOSTICS
All error messages are directed to the TIFFError(3T) routine.
Error post-encoding before directory write. Before writing the contents of the current directory, any pending data are flushed. This mes-
sage indicates that an error occurred while doing this.
Error flushing data before directory write. Before writing the contents of the current directory, any pending data are flushed. This mes-
sage indicates that an error occurred while doing this.
Cannot write directory, out of space. There was not enough space to allocate a temporary area for the directory that was to be written.
Error writing directory count. A write error occurred when writing the count of fields in the directory.
Error writing directory contents. A write error occurred when writing the directory fields.
Error writing directory link. A write error occurred when writing the link to the next directory.
Error writing data for field "%s". A write error occurred when writing indirect data for the specified field.
Error writing TIFF header. A write error occurred when re-writing header at the front of the file.
Error fetching directory count. A read error occurred when fetching the directory count field for a previous directory. This can occur
when setting up a link to the directory that is being written.
Error fetching directory link. A read error occurred when fetching the directory link field for a previous directory. This can occur when
setting up a link to the directory that is being written.
SEE ALSO
libtiff(3T), TIFFOpen(3T), TIFFError(3T), TIFFReadDirectory(3T), TIFFSetDirectory(3T)
September 26, 2001 TIFFWriteDirectory(3T)