Irregular Expressions

Feb 5 2010   9:20PM GMT

Finding VM snapshots – Part 2

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

Using find to locate vm’s with snapshots is easy.

`find /vmfs/volumes/ -type f -name "*00*.vmdk" | awk -F "/" '{print $1"/"$2"/"$3"/"$4"/"$5 }' | uniq`

Find is just not limited to locating the files but it is able to preform actions on it. Using the `-exec` allows any command to be executed.

`find /vmfs/volumes/ -type f -name “*00*.vmdk” -exec ls -alh {} \;`

Will execute `ls -alh` on each file that matches the parameters of the find command.  Adding this will provide date stamps on the files if needed.

Find can also work with dates itself, `-mtime` can be used to give find parameters on the last modified time of a file.  This can be specified in blocks of 24 hours, `-mtime +1` will give files last changed two days ago, not 1, this is because fractions of days are ignored.  Find can also be given multiple date parameters to narrow down the returned results as desired.

 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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

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: