Exscript.stdlib.file module¶
-
Exscript.stdlib.file.
chmod
(scope, filename, mode)[source]¶ Changes the permissions of the given file (or list of files) to the given mode. You probably want to use an octal representation for the integer, e.g. “chmod(myfile, 0644)”.
Parameters: - filename (string) – A filename.
- mode (int) – The access permissions.
-
Exscript.stdlib.file.
clear
(scope, filename)[source]¶ Clear the contents of the given file. The file is created if it does not exist.
Parameters: filename (string) – A filename.
-
Exscript.stdlib.file.
exists
(*args, **kwargs)[source]¶ Returns True if the file with the given name exists, False otherwise. If a list of files is given, the function returns True only if ALL of the files exist.
Parameters: filename (string) – A filename. Return type: bool Returns: The operating system of the remote device.
-
Exscript.stdlib.file.
mkdir
(scope, dirname, mode=None)[source]¶ Creates the given directory (or directories). The optional access permissions are set to the given mode, and default to whatever is the umask on your system defined.
Parameters: - dirname (string) – A filename, or a list of dirnames.
- mode (int) – The access permissions.
-
Exscript.stdlib.file.
read
(scope, filename)[source]¶ Reads the given file and returns the result. The result is also stored in the built-in __response__ variable.
Parameters: filename (string) – A filename. Return type: string Returns: The content of the file.
-
Exscript.stdlib.file.
rm
(scope, filename)[source]¶ Deletes the given file (or files) from the file system.
Parameters: filename (string) – A filename, or a list of filenames.
-
Exscript.stdlib.file.
write
(scope, filename, lines, mode=['a'])[source]¶ Writes the given string into the given file. The following modes are supported:
- ‘a’: Append to the file if it already exists.
- ‘w’: Replace the file if it already exists.
Parameters: - filename (string) – A filename.
- lines (string) – The data that is written into the file.
- mode (string) – Any of the above listed modes.