#!/usr/bin/perl use Time::HiRes; use File::Path; use warnings; use strict; $|=1; sub spin { my ($arg) = @_; for (my $x = 0; $x <= $arg; ++$x) { foreach (("-", "\\", "|", "/")) { print $_; Time::HiRes::sleep (0.1); print "\b"; } } #print " \n"; } my $j = 0; my $base = "C:/Users/User/Documents/Virtua~1/"; print "Enter VM name: "; my $vm = ; chomp ($vm); print "Enter Snapshot to be deleted: "; my $snapshot = ; chomp ($snapshot); my $vmware_dir = "C:/Progra~2/Vmware/VMware~1/"; my $command = "$vmware_dir" . "vmrun -T ws deleteSnapshot " . "$base" . "$vm" . "/" . "$vm" . ".vmx " . "$snapshot"; if ( (my $pid = fork() ) == 0) { do { sleep 0.5; spin($j) } while 1; } else { print "Deleting snapshot..."; system ("$command") or die "Operation failed: $!\n"; kill 9, $pid; waitpid $pid, 0; } print "\bDone!\n"; # Never gets here!