Latest Posts



Translate

Total Pageviews

Sunday, 2 February 2014

vifs command (ESXi)

NAME

vifs - perform file system operations on remote hosts

SYNOPSIS

 vifs [<connection_options>]
   [--copy <source> <target> |
    --dir <remote_dir> |
    --help |
    --force |
    --get <remote_path> <local_path> |
    --listdc |
    --listds [--dc <datacenter>] |
    --mkdir <remote_dir> |
    --move <source> <target> |
    --put <local_path> <remote_path> |
    --rm <remote_path> |
    --rmdir <remote_dir> ]

DESCRIPTION

The vifs command performs common operations such as copy, remove, get, and put on files and directories. The command is supported against ESX/ESXi hosts but not against vCenter Server systems.
Note: While there are some similarities between vifs and DOS or Unix file system management utilities, there are also many differences. For example, vifs does not support wildcard characters or current directories and, as a result, relative path names. Use vifs only as documented.

OPTIONS

connection_options
Specifies the target server and authentication information if required. Run vifs --help for a list of all connection options
--copy | -c <source> <target>
Copies a file in a datastore to another location in a datastore. The <source> must be a remote source path, the <target> a remote target path or directory. Use the--force option to replace existing destination files.
--dir | -D <remote_dir>
Lists the contents of a datastore or host directory.
--help
Prints a help message for each command-specific and each connection option. Calling the command with no arguments or with --help has the same effect.
--force | -f
Overwrites the destination file. Use with --copy and --move.
--get | -g <remote_path> <local_path>
Downloads a file from the ESX/ESXi host to the machine on which you run the vCLI commands. This operation uses HTTP GET.
--listdc | -c
Lists the datacenter paths available on an ESX/ESXi system.
--listds | -S
Lists the datastore names on the ESX/ESXi system. When multiple datacenters are available, you can use the --dc|-Z <datacenter> argument to specify the name of the datacenter from which you want to list the datastore.
--mkdir | -M <remote_dir>
Creates a directory in a datastore. This operation fails if the parent directory of remote_dir does not exist.
--move | -m <source> <target>
Moves a file in a datastore to another location in a datastore. The <source> must be a remote source path, the <target> a remote target path or directory. The --force option replaces existing destination files.
--put | -p <local_path> <remote_path>
Uploads a file from the machine on which you run the vCLI commands to the ESX/ESXi host. This operation uses HTTP PUT. This command can replace existing host files but cannot create new files.
--rm | -r <remote_path>
Deletes a file or a directory.
--rmdir | -r <remote_dir>
Deletes a datastore directory. This operation fails if the directory is not empty.

EXAMPLES

The following examples assume you are specifying connection options, either explicitly or, for example, by specifying the server, user name, and password. Run vifs --help for a list of common options including connection options.
Copy a file to another location:
 vifs <connection_options> -c "[StorageName] VM/VM.vmx" "[StorageName] VM_backup/VM.vmx"
List all the datastores:
 vifs <connection_options> -S
List all the directories:
 vifs --server <connection_options> -D "[StorageName] vm"
Upload a file to the remote datastore:
 vifs <connection_options> -p "tmp/backup/VM.pl"
    "[StorageName] VM/VM.txt" -Z "ha-datacenter"
Delete a file:
 vifs <connection_options> -r "[StorageName] VM/VM.txt" -Z "ha-datacenter"
 vifs <connection_options> -rmdir "[StorageName] VM/VM.txt" -Z "ha-datacenter"
List the paths to all datacenters available in the server:
 vifs <connection_options> -C
Download a file on the host to a local path:
 vifs <connection_options> -g  "[StorageName] VM/VM.txt" 
    -Z "ha-datacenter" "tmp/backup/VM.txt"
Move a file to another location:
 vifs <connection_options> -m  "[StorageName] VM/VM.vmx"  
    "[StorageName] vm/vm_backup.vmx" -Z "ha-datacenter"
Remove an existing directory:
 vifs <connection_options> -R "[StorageName] VM/VM" -Z "ha-datacenter"
 vifs <connection_options> --rm "[StorageName] VM/VM" -Z "ha-datacenter"

Thanks to Vmware Documentation