| brent timothy saner on 15 Apr 2014 11:53:05 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
| Re: [PLUG] "find" command troubles |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 04/15/2014 02:43 PM, Carl Johnson wrote:
> Why is the find command only coming back with 4_09_14 files?
> Shouldn't it be showing me the 04_11_14 files too based on the "+4"
> argument??
>
You can leave off the "-exec ls" part if you just want a list. :)
(you can also do -exec ls -l '{}' \; to repeat your two steps into one)
>
> [backup@fileserver ~]# /usr/bin/find /mnt/backup/* -type f -mtime
> +4 -exec ls {} \; /backup/04_09_14_backup.index
> /backup/04_09_14_backup.log
> /backup/smcfuels_server_backup--04_09_14--.tar.gz
the -mtime (and -mmin, etc.) is exclusive rather than inclusive- that
is to say, -mtime "+4" will find anything *older than* 4 days, not *4
days OR older*.
For example:
Apr 11 23:11 04_11_14_backup.index
If you ran the same find command tonight after 2311<whatever TZ your
box is on>, your find would return results from the 11th as it was
then 4 days exclusive.
To accomplish what you want, you'll actually have to do:
find /mnt/backup/ -type f -mtime "+3" [-exec ls -l '{}' \;]
The stuff in [] is optional, of course. (leave out the [] if you
actually want to include it)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJTTYAHAAoJEIwATC+TSB9redcP/Rec0n2p6GafztFdY+7cHyJi
lkElqP1ZId13Z9RRFwbGXPOespJMpxiiN28+gmn3jwRZINzEgRIt0vj86TS8z8LP
vmAiF+GWY2on8GoRaqNzqTNrbyodabTRC/BcISrpgjPxKGNk/iaZ/OJex3K5ymkG
ou0quNnO+kFu9RC9/Gey7Iud+7GV66miRHrqCK1/Fmzw3+L+xKSNaIZuFL95CCEO
QwvXT6HSH01YSkA1+tAF4FBtSmLb2T3lZX1xMFrve5+zLZbDZFNAGYoH97qy3AK+
e+R5Ag5edcFYIW59pNB4y867agQsrxuNZdMGDGeU+8OgC/Go/EL7EIkFVpMND24c
hPVBxrqsXLqOqtiGQFvZ8Mf3Zz22eu0AsHwnOfNgCDtox4zWAKQFREE++/oZntHW
S47KvbPCpX5+14L/2nLK8vBmlDHc+JVir6F7ui1eu4HmoXAbnEFkHvUgpzclao1i
WLVG28W7vyFqBzrQTV2VNaM9o2kNIlwR0mrxBY+MRYNpN43T6/rnOR8Ae44jdv/i
JkQ0FawkSuQ6RHv7LHivfqaz9/xReOjezSI8B7kV2ITuSzY2b9LvngW70P1xXwhA
8g1KhvXDPXVBWeTCNU3j0SX0lYbNStV+s60IBZ4Ctbx47za1Ptc1rRQnRKbtYO5X
7yCc4jPUvsr5kTsOs6qj
=iKwU
-----END PGP SIGNATURE-----
___________________________________________________________________________
Philadelphia Linux Users Group -- http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug