Sponsored Content
Top Forums Shell Programming and Scripting Shell Script for searching files with date as filter Post 21237 by kanakaraj_s on Tuesday 14th of May 2002 12:59:27 AM
Old 05-14-2002
Hi Cameron,
Thanks for your reply. Basically I wanted to automate a task to find the list of files modified from any date in the past till date.

I will pass the past date as an argument to the schell script. I will take the current system's date ,find the number of days between them and run the find command. I donot want to change the script in the future.
This is my actual requirement.

- How to define date variables in shell script
- How can I access system date inside the shell script and assign to a varialbe
- How to find the number of days between two dates

Thanks once again,
Kanak.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

shell script to find files by date and size

Hi, I have a directory PRIVATE in which I have several directories and each of these have several files. Therefore, I need to find those files by size and date to back up those files in another directory. I don't know how to implement this shell script using ''find''. appreciate any... (1 Reply)
Discussion started by: dadadc
1 Replies

2. Shell Programming and Scripting

shell script to find latest date and time of the files

Hi everyone, Please help:) I have a list of 1000 different files which comes daily to the directory.Some of the files are not coming to the directory now. I need to write a shell script to find the latest date and time of the files they came to the directory. The files should be unique.... (1 Reply)
Discussion started by: karthicss
1 Replies

3. Shell Programming and Scripting

Shell script help to eliminate files of todays date

Hi I am very new to shell scripting and have written a script (below). However the directory I am searching will contain a file with a .trn extension each day which I want to eliminate. Each day the file extension overnight will change to trx, if this fails I want to know. Basically what I... (2 Replies)
Discussion started by: richM
2 Replies

4. Shell Programming and Scripting

Shell Script to compare files, check current date and count

Hello - I have written the following basic shell script to count files, compare files and look for a particular strings in a file. Problem 1: How do I define more than 1 file location? #!/bin/bash #this is a test script FILES=$(ls /home/student/bin/dir1, home/student/bin/dir2)... (0 Replies)
Discussion started by: DallasT
0 Replies

5. Shell Programming and Scripting

ksh shell script to add date (YYYYMMDDHHMISS) to all .txt files in a folder

Everyday 15 files are written to a folder \app\where\thefiles\are\destined\CURRFOLDER Task1: I need to add date in YYYYMMDDHHMISS format to each of them. Example: File: ACCOUNT.txt Should be updated as: ACCOUNT_20101005175059.txt Task 2: After I update the files, they need to be ... (2 Replies)
Discussion started by: Duminix
2 Replies

6. Shell Programming and Scripting

find command to filter specific type of files older than certain date.

Hi I need to find the list of files in a directory and to do some specific operations based on the type of files. suppose in a directory am having .dat , .log, .err, .rej file types. i need to filter out .dat and .log only which are older than six months. i used the below query but the... (2 Replies)
Discussion started by: msathees
2 Replies

7. Shell Programming and Scripting

Script to filter by date

Hello, I currently have the need to perform backup, naming the file by date. How do I get the script, you can choose the most current file or current date and then upload it? My script is related to this topic that is already closed. Read Post Can anyone help me? (12 Replies)
Discussion started by: hdegenaro
12 Replies

8. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

9. Shell Programming and Scripting

Shell script to compare two files of todays date and yesterday's date

hi all, How to compare two files whether they are same are not...? like i had my input files as 20141201_file.txt and 20141130_file2.txt how to compare the above files based on date .. like todays file and yesterdays file...? (4 Replies)
Discussion started by: hemanthsaikumar
4 Replies

10. UNIX for Beginners Questions & Answers

Searching for a files based on current date directory

Hi All, I've been trying to do some recursive searching but not been very successful. Can someone please help. Scenario: I have directory structure /dir1/dir2/dir3/ 2019/ 11/ 17 18 19 20 so what I want to do is run a script and as its 2019/11/18/ today it would go and only search... (3 Replies)
Discussion started by: israr75
3 Replies
CHANGETRACK(1)						      General Commands Manual						    CHANGETRACK(1)

NAME
changetrack - track changes to files SYNOPSIS
changetrack [-h] [-c configfile] [-d directory] [-e] [-r] [-q] [-m message] [-M message] [-v] [-u] [-o toaddress] [-f fromaddress] DESCRIPTION
changetrack is a program to monitor changes to a bunch of files. If files are modified one day, and the machine starts working incorrectly some days later, changetrack can provide information on which files were modified, and help locate the problem. Normally changetrack uses ed to keep track of various revisions of the files by maintaining an .ed script with the change history for each file. Alternatively, changetrack can use rcs to keep track of various revisions of the files. Each file is "installed" in the rcs system the first time that changetrack is run after that file is added to the config file. Whenever changetrack is run after that, a copy of the file is made, which is 'checked in' and implicitly 'checked out' of the rcs system. See the man page of co for information on retrieving an old version of the file. Backup files (ending in tilde ~) are ignored, unless explicitely included. After each pattern in the file list, adding white space, a colon (:) then more whitespace, followed by email addresses, separated by more whitespace, will result in the changes to that file being emailed to that address. All changes from each run are expressed in one email. Using the email feature requires Mail::SendMail to be installed; if it does not work correctly, an error message will be printed to stan- dard error. OPTIONS
-h Display a short help message then exit. -cconfigfile Get the list of files to track from configfile instead of from ~/.changetrackrc (/etc/changetrack.conf for the super-user) -doutputdirectory Store output in outputdirectory instead of in ~/.changetrack/ (/var/lib/changetrack/ for the super-user) -e Keep a copy of the file from when it was first added to the changetrack configuration, and keep ed -styled changes to rebuild the file. This option is recommended only if rcs does not work on the machine. To recover using this means, the .ed file should have the last several commands removed, to allow the file to be rebuilt to the appropriate state. A command like 'cat myfile.ed | ed myfile.original' should be executed. -r Disable the rcs facility. -q Quiet mode; only print critical messages. Good for scripts. -mmessage Print message on each file, after checking for any changes. Good for indicating reboots or other system events. -Mmessage Like -m, but message is only printed on modified files. -v Print version and exit. -u Use unified diffs (this only works with some implementations of diff. -oemailaddress Mail output to emailaddress. This is supplementary to emails specified in the config file. -femailaddress Set "From" header to emailaddress, which must be fully qualified. REQUIREMENTS
This program requires diff. Unless the -r switch is used, this program requires rcs to be installed. If the -e switch is used, ed is required. FILES
~/.changetrackrc List of files to monitor. Each line may start with '#' indicating a comment. If a line is not a comment, it contains a file/pattern to monitor, and optionally " : " followed by any email addresses to send changes to. The filename may be a pattern described in the same way as for ls. Note: the default is /etc/changetrack.conf for root. ~/.changetrack/ Default directory in which to store output information. The default is /var/lib/changetrack/ for root. All rcs files are stored in this directory, unless a subdirectory called RCS exists, in which case the rcs files are stored in that directory. /etc/cron.daily/changetrack Script that creates the list of all files monitor. /etc/cron.hourly/changetrack Script that invocates changetrack. /etc/default/changetrack Configuration for the above two scripts. DIAGNOSTICS
Each filename is written to standard output. rcs will print errors if certain things go wrong. It will also print a few lines each time changetrack is run after a new file is added to the configuration. IDENTIFICATION
Author: Cameron J. Morland. Manual Page Revision: 2.1 Release Date: 2001-03-06. Copyright (C) 2001-2005 Cameron J. Morland. Changed by Jens Peter Secher to reflect the Debian modifications. SEE ALSO
ed(1), rcsintro(1), co(1) TODO
Automate removal of out-of-date changes, to save disk space and clarify the important changes. BUGS
None known. CHANGETRACK(1)
All times are GMT -4. The time now is 01:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy