Irregular Expressions

Feb 8 2010   10:07PM GMT

Finding VM snapshots – Part 3

Dan O'Connor Dan O'Connor Profile: Dan O'Connor

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 or you can type `man find` on the esx console.

 Comment on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: