--- title: "Ensure Asset" ---
This is generated from the built in components of Otter 2024.0, and may be different than what you have installed (especially if you have extensions); go to [Gear Icon] -> Administration -> Operations within your Otter instance to see exactly what operations are available.

Ensures the existence of an asset file on a server.

Script usage:

Ensure-Asset(
	Name: <text>,
	[Raft: <text>],
	[Type: <integer>],
	[Exists: <true/false>],
	Directory: <text>,
	[FileName: <text>]
);

This operation may be prefixed with Files::, although this is a built-in namespace and isn't really necessary.

Arguments:

NameFormatScript UsageUsage Notes
Asset name
text
Name
This argument is required.
Raft name
text
Raft
Asset type
integer
Type
Exists
true/false
Exists
Target directory
text
Directory
This argument is required.
Rename asset to
text
FileName
The name of the file on disk located in the path specified by the Directory argument. If no file name is specified, the operation will use the asset file name.

Example:


# ensures the config.yml file from the current raft is current on the server
Ensure-Asset config.yml (
    Path: F:\configs
);