Files modified since yy/mm/dd hh:mm

Files modified since yy/mm/dd hh:mm

Post by bert steenberg » Fri, 27 Jun 1997 04:00:00



Hi there,

Can anyone tell me how to print all the files that have been modified
since yesterday 07:00 till today 07:00 in a specific directory?

Bert S*bergen

 
 
 

Files modified since yy/mm/dd hh:mm

Post by Simon Faire » Fri, 27 Jun 1997 04:00:00



> Hi there,

> Can anyone tell me how to print all the files that have been modified
> since yesterday 07:00 till today 07:00 in a specific directory?

> Bert S*bergen

Look at the 'find' command in the man pages it will do exactly what you
want. Sorry but I can't remember the exact syntax at the moment.

Simon

 
 
 

Files modified since yy/mm/dd hh:mm

Post by harm b. j. ensi » Sat, 28 Jun 1997 04:00:00




Quote:

>Hi there,

>Can anyone tell me how to print all the files that have been modified
>since yesterday 07:00 till today 07:00 in a specific directory?

>Bert S*bergen

Try this:

Quote:> touch <timestamp> /tmp/file
> cd <directory>
> find . -newer /tmp/file print

where
 <timestamp> has the syntax MMDDhhmmYY
where
 MM = number of month
 DD = number of day
 hh = hour
 mm = minute
 YY = last two digits oy year
 
 
 

Files modified since yy/mm/dd hh:mm

Post by bill hunte » Sat, 28 Jun 1997 04:00:00


this way takes 2 steps;

first create a file with the exact date/time you want with "touch"
on solaris it's:
/usr/bin/touch 06260700 testfile
that's for month,date,hour,minute

then use the find commands "-newer" option.

find directory -newer testfile -print

 
 
 

Files modified since yy/mm/dd hh:mm

Post by Icarus Spar » Sat, 28 Jun 1997 04:00:00




>Can anyone tell me how to print all the files that have been modified
>since yesterday 07:00 till today 07:00 in a specific directory?

There are a number of ways you can do this. The simplest is if you can
arrange for files to be created at exactly these two times. Let us
assume that the files are called 'yesterday' and 'today', then

find . -type f -newer yesterday \! -newer today -print

would do what you want. If this is not possible, then you should probably
do a 'ls -lt' and write a small program to parse the date and time fields.
Of course you can do the whole thing in perl,

#!/usr/bin/perl

require 'timelocal.pl';

($sec,$min,$hours,$mday,$mon,$year,$rest)=gmtime;

$hours = 7;
$thismorning=timegm($sec,$min,$hours,$mday,$mon,$year);
$yesterdaymorning=$thismorning-(24*60*60);

for $filename (<*>) {
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
                    $atime,$mtime,$ctime,$blksize,$blocks)
                        = stat($filename);
        if (($mtime>=$yesterdaymorning) && (mtime < $thismorning)) {
                print $filename,"\n";
        }

Quote:}

Icarus
 
 
 

Files modified since yy/mm/dd hh:mm

Post by Eric R. Augusti » Tue, 01 Jul 1997 04:00:00


Depending on the operating system you are using the utility 'find'
may be the answer.  Read the manual page on usage for that program.
The version available on SunOS 4.1.3 only resolves in terms of days
and not hours so it would do you no good in that case.  Generally
I've resorted to writing programs in C to grab that sort of infor-
mation since the 'stat' and 'time' C library commands can be used
to solve a problem of this nature rather well.

However, this is a shell group and I don't know how your access to
a compiler is.

: Can anyone tell me how to print all the files that have been modified
: since yesterday 07:00 till today 07:00 in a specific directory?
:
: Bert S*bergen
:

--

 .trog--


-- 'The indians are coming, I saw it on tv...
-- They're 20,000 strong but, they always get depleted by the calvary...
-- Salvation is at hand, it's garanteed...
-- Just send a donation straight to God, 1-800-TOL-FREE...'
-- Deep Purple, Strange Ways

 
 
 

Files modified since yy/mm/dd hh:mm

Post by Ramesh Kurunatha » Fri, 04 Jul 1997 04:00:00


: Can anyone tell me how to print all the files that have been modified
: since yesterday 07:00 till today 07:00 in a specific directory?
:
: Bert S*bergen
:

How about creating 2 files with the times you want then using find to
display files that were created between those two dates.

e.g. to find which files were created between 0700 yesterday (2nd july)
and today (3 july) from the current directory, do the following:

$ touch 0702070097 file1
$ touch 0703070097 file2
$ find . -newer file1 ! -newer file2 -print

of course you need to have a version of touch that allows you to set the
timestamps of files. You can remove the new files after you finished.

I got this tip from the O'Reilly & Associates book - "Unix Power Tools".
I highly recommend it.

regards
Ramesh

 
 
 

1. Changing all date fields from mm/dd/yy to dd/mm/yy

Please, I'm looking for a way to change all date fields in a specified
file, like this:

solaris> cat file

05/23/06      03/12/06

07/10/06                   11/12/06           09/20/06

      03/11/06

I need change all date field from mm/dd/yy to dd/mm/yy, like this:

solaris> ./script < cat file

23/05/06        12/03/06

10/07/06                 12/11/06             20/09/06

       11/03/06

Thanks !

2. Fixes for cmdtool

3. How to convert Unix date to DD/MM/YYYY HH:MM:SS

4. Calling all gurus: Problems setting up Linux. HELP!!!!

5. how to convert given no. into unix dd:mm:yyyy -hh:mm:ss format

6. Frontpage & Netscape Server

7. need "yy-ddd-hh:mm:ss ==> (time_t) clock" converter

8. un-TARing a file with hard path names

9. How to read file modification date (mm-dd-yy) in Korn

10. Date-time conversion from "YYYY-MM-DD HH:MI:SS" to unix epoch

11. sort MM/DD/YY in reverse chron order with -k...

12. Sort by First Date Field (MM/DD/YY)

13. HELP: C prog to get mm/dd/yy format