Sponsored Content
Full Discussion: mtime
Top Forums Shell Programming and Scripting mtime Post 302291152 by ss_ss on Tuesday 24th of February 2009 09:58:48 PM
Old 02-24-2009
mtime

Hi,

I've some files of some past days and everyday some new files are also getting added to the same.

Now how can i use mtime to get the files of the current date i.e if i want the files of 25th feb 2009 and if im finding the files on 25th 12:10 am then i should only get the files after 12:00 am of 25th feb 2009.

right now im doing it this way but this gives me the files modified less than 1 day ago i.e., within the past 24 hours, as before.

Code:
find . -name '*.xml' -mtime -1 -exec basename {} \; >>Today.xml

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

mtime help!!!!!

thank you for the help. (2 Replies)
Discussion started by: scooter17
2 Replies

2. Shell Programming and Scripting

mtime

hi, :) consider the following statement find . -type f -mtime -1 -print here what is the use of -1 option. any help? cheers RRK (7 Replies)
Discussion started by: ravi raj kumar
7 Replies

3. Shell Programming and Scripting

problem in mtime

Hey champs, i am using the following commands to search 1day files available under a dir by shell script. find <dirname> -type f -mtime +1 sometimes it used to show me correct results.....but sometimes it's not ??? if the above one not working perfect i.e. not showing me the exact... (2 Replies)
Discussion started by: manas_ranjan
2 Replies

4. UNIX for Dummies Questions & Answers

-mtime +30

Hello, Can someone help me to understand the following: find /test/rman/ -mtime +30 -exec rm '{}' \; What does -mtime +30 mean? Thanks! (1 Reply)
Discussion started by: Blue68
1 Replies

5. AIX

-mtime Problem

Hi, I'm using command "find . -mtime +10 -type f -print" to list the files 10 days or older but I'm getting the files which are even created today. What am I doing wrong? Thanks. (1 Reply)
Discussion started by: Gbyte
1 Replies

6. UNIX for Dummies Questions & Answers

(find) mtime vs. (unix) mtime

Hi I've made some test with perl script to learn more about mtime... So, my question is : Why the mtime from findfind /usr/local/sbin -ctime -1 -mtime -1 \( -name "*.log" -o -name "*.gz" \) -print are not the same as mtime from unix/linux in ls -ltr or in stat() function in perl : stat -... (2 Replies)
Discussion started by: hiddenshadow
2 Replies

7. Shell Programming and Scripting

find -mtime +7

Dear all, find $ADMIN_DIR/$SID/arch/ -name '*.gz' -mtime +7 -exec rm {} \; is it retaining 7 days OR 8 days .gz files ? Thanks Prakash (10 Replies)
Discussion started by: prakashoracledb
10 Replies

8. Red Hat

-mtime command

Hello, what this command do. find /oracle/u01/app/oracle/admin/rdz/udump/ -name "*.trc" -mtime +1 Thanks, Umair (1 Reply)
Discussion started by: umair
1 Replies

9. UNIX for Dummies Questions & Answers

Find using mtime

Hi, so I was using mtime and its not behaving the way I would think its supposed too. I have two pdf files. One modified today and another 6 months ago. I upload them to the solaris server. Then I run the below find statements. This finds my 2 files find *.pdf -type f -name '*.pdf' this finds... (2 Replies)
Discussion started by: vsekvsek
2 Replies

10. UNIX for Dummies Questions & Answers

rsync and mtime

Hi, I'm sure this will be covered here already somewhere, but a search didn't throw up anything. I'm trying to work out the extra bits needed in this command for this rsync so that it only copies files less than 7 days old: rsync me@host:/logs/* . I'm sure it just needs the mtime -7... (2 Replies)
Discussion started by: dlam
2 Replies
Touch(3pm)						User Contributed Perl Documentation						Touch(3pm)

NAME
File::Touch - update access and modification timestamps, creating nonexistent files where necessary. SYNOPSIS
use File::Touch; @file_list = ('one.txt','../two.doc'); $count = touch(@file_list); use File::Touch; $reference_file = '/etc/passwd'; $touch_obj = File::Touch->new( reference => $reference_file, no_create => 1 ); @file_list = ('one.txt','../two.doc'); $count = $touch_obj->touch(@file_list); DESCRIPTION
Here's a list of arguments that can be used with the object-oriented contruction: atime_only => [0|1] If nonzero, change only the access time of files. Default is zero. mtime_only => [0|1] If nonzero, change only the modification time of files. Default is zero. no_create => [0|1] If nonzero, do not create new files. Default is zero. reference => $reference_file If defined, use timestamps from this file instead of current time. Default is undefined. atime => $time If defined, use this time (in epoch seconds) instead of current time for access time. mtime => $time If defined, use this time (in epoch seconds) instead of current time for modification time. Examples Update access and modification times, creating nonexistent files use File::Touch; my @files = ('one','two','three'); my $count = touch(@files); print "$count files updated "; Set access time forward, leave modification time unchanged use File::Touch; my @files = ('one','two','three'); my $day = 24*60*60; my $time = time() + 30 * $day; my $ref = File::Touch->new( atime_only => 1, time => $time ); my $count = $ref->touch(@files); print "$count files updated "; Set modification time back, update access time, do not create nonexistent files use File::Touch; my @files = ('one','two','three'); my $day = 24*60*60; my $time = time() - 30 * $day; my $ref = File::Touch->new( mtime => $time, no_create => 1 ); my $count = $ref->touch(@files); print "$count files updated "; AUTHOR
Nigel Wetters Gourlay (nwetters@cpan.org) COPYRIGHT
Copyright (c) 2001,2007,2009 Nigel Wetters Gourlay. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. perl v5.10.0 2009-07-25 Touch(3pm)
All times are GMT -4. The time now is 07:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy