6.0

Table Of Contents
VMware, Inc. 35
Chapter 3 Managing Files
vifs <conn_options> --dir '[osdc-cx700-02]'
Thecommandliststhecompletecontentsofthedatastore.
Working with Directories and Files on the Remote Server
Createanewdirectoryinadatastorewith--mkdir <remote_dir>.
vifs --server <my_ESXi> --username root --password <pswd> --mkdir '[Storage1] test'
Removeadirectorywith--rmdir <remote_dir>.
vifs --server <my_ESXi> --username root --password <pswd> --rmdir '[Storage1] test'.
Forciblyremoveadirectorywith--rmdir --force <remote_dir>.
vifs --server <my_ESXi> --username root --password <pswd> --rmdir '[Storage1] test2' --force
Updateafileontheremoteserverwith--put <local_path> <remote_path>.
vifs --server <my_ESXi> --username root --password <pswd>
--put /tmp/testfile '[Storage1] test/testfile'
Retrieveafilefromtheremoteserverwith--get <remote_path> <local_path>|<local_dir>.The
commandoverwritesthelocalfileifitexists.Ifyoudonotspecifyafilename,thefilenameoftheremote
fileisused.
vifs --server <my_ESXi> --username root --password <pswd> --get '[Storage1] test/testfile'
/tmp/tfile
vifs --server <my_ESXi> --username root --password <pswd> --get '[Storage1] test/testfile'
/tmp
Deleteafileontheremoteserverwith-rm <remote_path>.
vifs --server <my_ESXi> --username root --password <pswd> --rm '[Storage1] test2/testfile'
Forciblyremoveafileontheremoteserverwith--rm <remote_path> --force.
vifs --server <my_ESXi> --username root --password <pswd> --rm '[Storage1] test2/testfile2'
--force
Moveafilefromonelocationontheremoteservertoanotherlocationwith--move
<remote_source_path> <remote_target_path>.Ifyouspecifyafilename,thefileismovedand
renamedatthesametime.
vifs --server <my_ESXi> --username root --password <pswd> --move '[Storage1] test/tfile'
'[Storage1] newfile'
Ifthetargetfilealreadyexistsontheremoteserver,thecommandfailsunlessyouuse--force.
vifs --server <my_ESXi> --username root --password <pswd> --move '[Storage1] test/tfile2'
'[Storage1] test2/tfile' --force
Createacopyofafileontheremoteserveratadifferentlocationontheremoteserver.
vifs --server <my_ESXi> --username root --password <pswd> --copy '[Storage1] test/tfile'
'[Storage1] test/tfile2'
Ifthetargetfilealreadyexistsontheremoteserver,thecommandfailsunlessyouuse--force.
vifs --server <my_ESXi> --username root --password <pswd> --copy '[Storage1] test/tfile'
'[Storage1] test/tfile2' --force
Example Scenario
Thefollowingexamplescenarioillustratesotherusesofvifs.Specifyoneoftheconnectionoptionslistedin
“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To manage files and directories on the remote ESXi system
1 Createadirectoryinthedatastore.
vifs <conn_options> --mkdir '[osdc-cx700-03] vcli_test'
Youmustspecifytheprecisepath;thereisnoconceptofarelativepath.