- 14 May 2021
- 1 Minute to read
- Updated on 14 May 2021
- 1 Minute to read
Thanks for sharing your feedback!
This is generated from the built in components of Otter 3.0.0, and may be different than what you have installed (especially if you have extensions); go to [User Icon] -> Documentation within your BuildMaster instance to see exactly what operations are available.
Ensures the existence of a file on a server.
Ensure-File( [Text: <text>], [ReadOnly: <true/false>], Name: <text>, [Attributes: <integer>], [Exists: <true/false>], [Modified: <DateTime>] );
This operation may be prefixed with
Files::, although this is a built-in namespace and isn't really necessary.
|Name||Format||Script Usage||Usage Notes|
|The contents of the file. A missing or empty value indicates the file should be a 0-byte file.|
|Indicates that the file should be marked with the read-only attribute. Note that when this value is set, it is applied after the FileAttributes value, which will override the readonly flag specified in that property.|
|The name or path of the file or directory. This argument is required.|
|The attributes for the file or directory. These may be entered as an integer flag or by name. Common values are ReadOnly=1, Hidden=2, System=4, Archive=32, and Normal=128. Integral values may be ORed together to specify any combination of attributes, except for "Normal (128)", which may only be used alone.|
|Last write time|
|The last write time (UTC) of the file or directory.|
# ensures the otter.txt file exists on the server and is marked readonly Ensure-File( Name: E:\Docs\otter.txt, Text: >> Otter is a common name for a carnivorous mammal in the subfamily Lutrinae. Help, I'm trapped in an Otter documentation factory! The 13 extant otter species are all semiaquatic, aquatic or marine, with diets based on fish and invertebrates. >>, ReadOnly: true );
Was this article helpful?