Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Search files between date ranges - Ctime usage Post 302997419 by Don Cragun on Friday 12th of May 2017 10:33:01 PM
Old 05-12-2017
Quote:
Originally Posted by r@v!7*7@
Hi Don, Thanks for the reply.
The solution you provided is working perfectly for this scenario.

We also have a requirement where the files are placed in our directory on a daily basis.
In this case, we want the choose and process the file based on a date (placed in our directory) range. The solution you provided is not working in this case as it looking at the file creation date.
As I said before, most filesystems DO NOT STORE a file creation date for files and there is no way to determine the date on which a file was created using standard interfaces. If the last modification timestamp of a file is insufficient for you needs, you need to:
  1. make sure that you are storing these files on a filesystem type that keeps track of file creation dates, find an operating system specific way to look at the file's creation date for files on that filesystem, and find a way to use that operating system specific way of examining files to select the files you want to process,
  2. include the file creation date in the pathnames of your files and select files to process based on the date in each file's pathname, or
  3. put unprocessed files in a separate directory and move them to a different directory after they have been processed.
Since you haven't told us what operating system AND filesystem type you're using, we have no way to guess whether or not what you want is possible with method 1. You can use method 2 or 3 on any operating system.
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find command: various date ranges

Hi, I have writtena script that will recursivly go into subdirecotries and report out what files there are in there that have not been accessed over various date ranges. I do this using a number of find commands: find . -path './.snapshot' -prune -o -type f -atime -8 find... (4 Replies)
Discussion started by: littleIdiot
4 Replies

2. Shell Programming and Scripting

Search values between ranges in File1 within File2

Hi people, I have 2 files, one with a list of non consecutive ranges (File1.txt), where each range begins with the value in column 1 and finishes with the value in column 2 in the same line, as can be seen above. 215312581156279 215312581166279 215312582342558 215312582357758... (4 Replies)
Discussion started by: cgkmal
4 Replies

3. Shell Programming and Scripting

date ranges

Hi, Please anyone help to achive this using perl or unix scripting . This is date in my table 20090224,based on the date need to check the files,If file exist for that date then increment by 1 for that date and check till max date 'i.e.20090301 and push those files . files1_20090224... (2 Replies)
Discussion started by: akil
2 Replies

4. Shell Programming and Scripting

search on weblogic logs with date time ranges 2

Hi All, The developers want me to search and capture the weblogic log, you know this big logs of htmls. They want to me to have ranges on the date and time. Like from "2010-01-20 14:04:46,186" to "2010-01-20 15:00:12,490" I can only do this, cat /usr/local/bea/logs_prod1/debug.log |... (1 Reply)
Discussion started by: itik
1 Replies

5. Linux

search on weblogic logs with date time ranges

Hi All, The developers want me to search and capture the weblogic log, you know this big logs of htmls. They want to me to have ranges on the date and time. Like from "2010-01-20 14:04:46,186" to "2010-01-20 15:00:12,490" I can only do this, cat /usr/local/bea/logs_prod1/debug.log... (1 Reply)
Discussion started by: itik
1 Replies

6. Shell Programming and Scripting

getting files between specific date ranges in solaris

hi ! how can i get files in a directory between certain date ranges ? say all files created/modified between Jan24 - Jan31 thanks (10 Replies)
Discussion started by: aliyesami
10 Replies

7. Shell Programming and Scripting

Search IP Address in list of ranges -- not working great

I have been struggling with a script to automate some security related activities. I have it pretty much working, all except the search. I have an input file formatted as such: 216.234.246.158 216.234.246.158 `` 24.249.221.22 24.249.221.200 `` 24.249.226.0 ... (4 Replies)
Discussion started by: tsunami4u
4 Replies

8. Shell Programming and Scripting

Search files with today date and files come anytime in between 10 pm to 1 am

Hi, i want to make script. In a directory everyday( exclude sat and sun) in between 10 pm to 1 am there are 2 files comes and when file comes it will mail us. Format for files is mentioned below. please help me on making this, and also have year end consider and if files come after 12 am it... (6 Replies)
Discussion started by: pallvi_mahajan
6 Replies

9. Programming

Derivation of values falling on date ranges

Hi Guys, I am having below tables used in oracle bal ID BALANCE BAL_DATE 1 -11.71 01-JAN-05 00.00.00 1 -405.71 02-JAN-05 00.00.00 1 -760.71 03-JAN-05 00.00.00 ref_table PRODUCT EFF_FROM_DATE EFF_TO_DATE TYPE MIN_AMT MAX_AMT CHARGE 12 01-JAN-05 00.00.00 01-JAN-06... (6 Replies)
Discussion started by: rohit_shinez
6 Replies

10. Shell Programming and Scripting

Grepping the data between 2 date ranges

Hi There, Good Day !! I have txt file containing data in the below format. There are many lines, here i have mentioned for example. cat remo.txt 2/3/2017 file1 3/4/2016 file2 6/6/2015 file5 1/1/2018 file3 4/3/2014 file4 - - - I need to grep the file names for given date rage... (11 Replies)
Discussion started by: kumar85shiv
11 Replies
DUMP(8) 						      System Manager's Manual							   DUMP(8)

NAME
dump - incremental file system dump SYNOPSIS
dump [0123456789BchfusTdWwn [argument ...]] [filesystem] DESCRIPTION
Dump copies to magnetic tape all files changed after a certain date in the filesystem. The following options are supported by dump: 0-9 This number is the `dump level'. All files modified since the last date stored in the file /etc/dumpdates for the same filesystem at lesser levels will be dumped. If no date is determined by the level, the beginning of time is assumed; thus the option 0 causes the entire filesystem to be dumped. B records The number of dump records per volume. This option overrides the calculation of tape size based on length and density. c This option requires no further options. Used to specify that the tape is a cartridge drive rather than a 9-track. h level Honor the user 'nodump' flags only for dumps at or above the given level. The default honor level is 1, so that incremental backups omit such files but full backups retain them. f Place the dump on the next argument file instead of the tape. If '-' is given then standard out (stdout) is written to. u If the dump completes successfully, write the date of the beginning of the dump on file /etc/dumpdates. This file records a separate date for each filesystem and each dump level. The format of /etc/dumpdates is readable by people, consisting of one free format record per line: filesystem name, increment level and ctime(3) format dump date. /etc/dumpdates may be edited to change any of the fields, if necessary. Note that /etc/dumpdates is in a format different from that which previous versions of dump maintained in /etc/ddate, although the information content is identical. s The size of the dump tape is specified in feet. The number of feet is taken from the next argument. When the specified size is reached, dump will wait for reels to be changed. The default tape size is 2300 feet. d The density of the tape, expressed in BPI, is taken from the next argument. This is used in calculating the amount of tape used per reel. The default is 1600. T date Use the specified date as the starting time for the dump instead of the time determined from looking in /etc/dumpdates. The format of date is the same as that of ctime(3). This option is useful for automated dump scripts that wish to dump over a specific period of time. The T option is mutually exclusive with the u option. W Dump tells the operator what file systems need to be dumped. This information is gleaned from the files /etc/dumpdates and /etc/fstab. The W option causes dump to print out, for each file system in /etc/dumpdates the most recent dump date and level, and highlights those file systems that should be dumped. If the W option is set, all other options are ignored, and dump exits immedi- ately. w Is like W, but prints only those filesystems which need to be dumped. n Whenever dump requires operator attention, notify by means similar to a wall(1) all of the operators in the group "operator". If no arguments are given, the key is assumed to be 9u and a default file system is dumped to the default tape. Dump requires operator intervention on these conditions: end of tape, end of dump, tape write error, tape open error or disk read error (if there are more than a threshold of 32). In addition to alerting all operators implied by the n key, dump interacts with the operator on dump's control terminal at times when dump can no longer proceed, or if something is grossly wrong. All questions dump poses must be answered by typing "yes" or "no", appropriately. Since making a dump involves a lot of time and effort for full dumps, dump checkpoints itself at the start of each tape volume. If writing that volume fails for some reason, dump will, with operator permission, restart itself from the checkpoint after the old tape has been rewound and removed, and a new tape has been mounted. Dump tells the operator what is going on at periodic intervals, including usually low estimates of the number of blocks to write, the num- ber of tapes it will take, the time to completion, and the time to the tape change. The output is verbose, so that others know that the terminal controlling dump is busy, and will be for some time. Now a short suggestion on how to perform dumps. Start with a full level 0 dump dump 0un Next, dumps of active file systems are taken on a daily basis, using a modified Tower of Hanoi algorithm, with this sequence of dump lev- els: 3 2 5 4 7 6 9 8 9 9 ... For the daily dumps, a set of 10 tapes per dumped file system is used on a cyclical basis. Each week, a level 1 dump is taken, and the daily Hanoi sequence repeats with 3. For weekly dumps, a set of 5 tapes per dumped file system is used, also on a cyclical basis. Each month, a level 0 dump is taken on a set of fresh tapes that is saved forever. FILES
/dev/rxp0a default filesystem to dump from /dev/rmt0 default tape unit to dump to /etc/ddate old format dump date record (obsolete after -J option) /etc/dumpdates new format dump date record /etc/fstab Dump table: file systems and frequency /etc/group to find group operator SEE ALSO
restor(8), rdump(8), dump(5), fstab(5), dumpdir(8) DIAGNOSTICS
Many, and verbose. BUGS
Sizes are based on 1600 BPI blocked tape; the raw magtape device has to be used to approach these densities. Fewer than 32 read errors on the filesystem are ignored. Each reel requires a new process, so parent processes for reels already written just hang around until the entire tape is written. It would be nice if dump knew about the dump sequence, kept track of the tapes scribbled on, told the operator which tape to mount when, and provided more assistance for the operator running restor. 4th Berkeley Distribution DUMP(8)
All times are GMT -4. The time now is 04:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy