12-07-2007
Finding modified File List after the chosen date in Korne Shell...
I am trying to write a Korne Shell asking the user for a date and a directory and then search recursively in this directory the list of files modified after the date chosen. But I am not getting good results when I Test it...
#!/usr/bin/ksh
echo "Enter a date (YYYYMMDD) "
read date
touch -t 00000000 /tmp/timestamp
echo "Enter a directory.."
read dir
find "$dir" -type f -newer /tmp/timestamp
I earlier used -mtime, but it should not be used, as -mtime searches for files older by no. of days and not for files modified after a particular date.
Can anyone please provide with some pointers to my above Code wrt the mistakes that I did..
Thanks a lot in advance... :-))
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am trying to load a group of files and their last dates modified into a text file that will in turn be used with SQL*Loader to load these files into Oracle. I am using a *.ksh script. I am getting the name of the file in by using the following:
for file_ext in 'cat loaddir.ext';
do
find... (2 Replies)
Discussion started by: akpopa
2 Replies
2. Solaris
Hi ,
I am trying to find out the List of files modified or added aftter installation of any component on SUN solaris box .
But i am not able to do it using ls or find command .
Can somebody help me out ?
Thanks
Sanjay Gupta (2 Replies)
Discussion started by: sanajyg_mnit
2 Replies
3. UNIX for Dummies Questions & Answers
Hello Mates! I'm kinda new to unix and need to a solve a problem.
Input: date
Situation: With the given date I need to find a list of all such files starting from a given path that were modified after the given date.
I experimented with the "find" with "-newer" but did not quite get it... (4 Replies)
Discussion started by: rkka
4 Replies
4. Shell Programming and Scripting
hi,
I want to find a file which is modified within last 2 hours
i am using sun-os
i tried find . -name <filename> -mmin 120
i found that mmin option is not supported in sun-os is there any other alternative option
suggestions welcome
thanks in advance (5 Replies)
Discussion started by: trichyselva
5 Replies
5. Shell Programming and Scripting
Dear all,
Need a quick help/suggestion on monitoring a particular directory .
We have a deployment directory say (/users/integration/deploy ) under this there are several files which can be edited by a number of users -
We need to write a script which will check this deployment directory... (5 Replies)
Discussion started by: jambesh
5 Replies
6. UNIX for Advanced & Expert Users
Hi,
I am new bie to Unix. Might be a simple question I am asking.
I want to find the last modified time of a file and find the difference between the currrent time and the last modified time. Appreciate, if someone can throw some light on what commands can be used.
Cheers,
James (2 Replies)
Discussion started by: JamesJoe
2 Replies
7. Shell Programming and Scripting
Hi ,
In my directory , i have many days file but i want to see all those which are of todays date.
i tried this but it gives all the files
mtime -0 |ls -ltr
I tried the below option as well.
19635 find -iname "*.LOG" -mtime
19636 ls -ltr *.LOG -mtime -1
19637 ls -ltr *.LOG... (7 Replies)
Discussion started by: guddu_12
7 Replies
8. Shell Programming and Scripting
I am trying to look into multiple directories and pluck out the latest version of a specific file, regardless of where it sits within the directory structure.
Ex:
The file is a .xls file and could have a depth within the directory of anywhere from 1-5
Working directory - Folder1... (6 Replies)
Discussion started by: co21ss
6 Replies
9. AIX
I'm using a script that I need to get a file's "last modified date" in a format like 01:51:14 PM. We are running on AIX 6.1.0.0. I can't seem to find the right command parameters. Help! (4 Replies)
Discussion started by: mattadams1983
4 Replies
10. OS X (Apple)
Hi,
Am performing a find based on filename and result can contain multiple files being found
Let's say my find command is
find /Archive -f -name 12345.pdf
and result of find command is
/Archive/Folder A/12345.pdf
/Archive/Folder B/12345.pdf
please note white space in folder names
I... (2 Replies)
Discussion started by: gigagigosu
2 Replies
GMDATE(3) 1 GMDATE(3)
gmdate - Format a GMT/UTC date/time
SYNOPSIS
string gmdate (string $format, [int $timestamp = time()])
DESCRIPTION
Identical to the date(3) function except that the time returned is Greenwich Mean Time (GMT).
PARAMETERS
o $format
- The format of the outputted date string. See the formatting options for the date(3) function.
o $timestamp
- The optional $timestamp parameter is an integer Unix timestamp that defaults to the current local time if a $timestamp is not
given. In other words, it defaults to the value of time(3).
RETURN VALUES
Returns a formatted date string. If a non-numeric value is used for $timestamp, FALSE is returned and an E_WARNING level error is emitted.
CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.1.0 | |
| | |
| | The valid range of a timestamp is typically from |
| | Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 |
| | 03:14:07 GMT. (These are the dates that corre- |
| | spond to the minimum and maximum values for a |
| | 32-bit signed integer). However, before PHP 5.1.0 |
| | this range was limited from 01-01-1970 to |
| | 19-01-2038 on some systems (e.g. Windows). |
| | |
| 5.1.1 | |
| | |
| | There are useful constants of standard date/time |
| | formats that can be used to specify the $format |
| | parameter. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
gmdate(3) example
When run in Finland (GMT +0200), the first line below prints "Jan 01 1998 00:00:00", while the second prints "Dec 31 1997
22:00:00".
<?php
echo date("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 1998));
echo gmdate("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 1998));
?>
SEE ALSO
date(3), mktime(3), gmmktime(3), strftime(3).
PHP Documentation Group GMDATE(3)