Posted by: Dan O'Connor
find, snap shot, snapshot, sort, uniq, unix, vmware, wc
Find can be given multiple date constraints to narrow down the results returned.
`find /vmfs/volumes/ -mtime +1 -mtime -10 -type -f -name “*00*.vmdk”`
Will locate files that where the file was last modified at least 1 day ago (-mtime +1) but not more then 10 (-mtime -10).
Find has several parameters to work with dates.
ctime – Locate items by the last status change time.
atime – Locate items by the last access time.
mtime – Locate items by the last modified time.
You can also get more granular on the time tests. With -amin, -cmin, and -mmin.
The -name is not specifically needed, you could also use a regular expression to locate the files that are needed.
find /vmfs/volumes/ -regex ‘.*[0-9]+\.vmdk$’ -type f
While the regular expression is useful it will preform the regex on the path returned as well so the results will differ from searching `/vmfs/volumes/` and `.`.
The full find man page is online here http://linux.die.net/man/1/find or you can type `man find` on the esx console.