I like to know how i can get a long listing of files using rcli command....
so far i can only use :
vifs.pl --server servername --username root --password xxxxxxxx --dir foldername
This does list the files but not their sizes etc.
I know I can also browse datastore contents and host files using a web browser by connecting to http://ESX3ihost_IP_Address/folder where it does list file sizes
vifs.pl by default will just do a standard listing, you will not be able to see hidden files. If you're looking to get fileSize, fileType and modification you'll need to write a new script using the VI API and specifically creating a HostDatastoreBrowserSearchSpec to search the Datastore of interest.
Here is a small snippet of code from another script that shows this in action, you'll need to create a FileQueryFlags specifying what attributes you would like to view and then specifying the Datastore path and passing in the searchSpec which could also include pattern matching.
#capture VM dir contents w/delta files my $browser = Vim::get_view (mo_ref => $ds->browser); my $ds_path = ""; my $file_query = FileQueryFlags->new(fileSize => 1,fileType => 0,modification => 1); my $searchSpec = HostDatastoreBrowserSearchSpec->new(details => $file_query,matchPattern => ); my $search_res = $browser->SearchDatastoreSubFolders(datastorePath => $ds_path,searchSpec => $searchSpec); if ($search_res) { foreach my $result (@$search_res) { my $files = $result->file; if ($files) { foreach my $file (@$files) { if($file->path =~ /-delta.vmdk/ ) { my ($vm_snapshot_date,$vm_snapshot_time) = split('T',$file->modification); #my $todays_date =`date +\%Y-\%m-\%d`; my $todays_date = giveMeDate('YMD'); chomp($todays_date); my $diff = days_between($vm_snapshot_date, $todays_date); my $snap_time = $vm_snapshot_date." ".$vm_snapshot_time; setSnapColor($diff,$result->folderPath,$file->path,$file->fileSize,$snap_time); } } } } }
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
If you find this information useful, please award points for "correct" or "helpful".