RPA.Archive
Add file(s) to the archive
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
files | List, str | null | name of the file, or list of files, to add |
archive_name | str | null | filename of the archive |
folder | str, None | None | name of the folder where the file will be added, relative path within the archive |
param files: | name of the file, or list of files, to add |
---|---|
param archive_name: | |
filename of the archive | |
param folder: | name of the folder where the file will be added, relative path within the archive |
return: | None |
This keyword adds a file or list of files into an existing archive. Files can be added to archive structure with relative path using argument folder.
Examples
Create a tar/tar.gz archive of a folder
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
folder | str | null | name of the folder to archive |
archive_name | str | null | filename of the archive |
recursive | bool | False | should sub directories be included, default is False |
include | str, None | None | define file pattern to include in the package, default is None which means all files are included |
exclude | str, None | None | define file pattern to exclude from the package, default is None |
param folder: | name of the folder to archive |
---|---|
param archive_name: | |
filename of the archive | |
param recursive: | |
should sub directories be included, default is False | |
param include: | define file pattern to include in the package, default is None which means all files are included |
param exclude: | define file pattern to exclude from the package, default is None |
return: | None |
This keyword creates an TAR or TAR.GZ archive of a local folder. Type of archive is determined by the file extension. By default subdirectories are not included, but they can included using recursive argument.
To include only certain files, like TXT files, the argument include can be used. Similarly to exclude certain file, like dotfiles, the argument exclude can be used.
Examples
Create a zip archive of a folder
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
folder | str | null | name of the folder to archive |
archive_name | str | null | filename of the archive |
recursive | bool | False | should sub directories be included, default is False |
include | str, None | None | define file pattern to include in the package, default is None which means all files are included |
exclude | str, None | None | define file pattern to exclude from the package, default is None |
compression | str | stored | type of package compression method, default is "stored" |
param folder: | name of the folder to archive |
---|---|
param archive_name: | |
filename of the archive | |
param recursive: | |
should sub directories be included, default is False | |
param include: | define file pattern to include in the package, default is None which means all files are included |
param exclude: | define file pattern to exclude from the package, default is None |
param compression: | |
type of package compression method, default is "stored" | |
return: | None |
This keyword creates an ZIP archive of a local folder. By default subdirectories are not included, but they can be included using the recursive argument.
To include only certain files, like TXT files, the argument include can be used. Similarly to exclude certain files, like dotfiles, the argument exclude can be used.
Compression methods:
- stored, default
- deflated
- bzip2
- lzma
Examples
Extract files from archive into local directory
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
archive_name | str | null | filename of the archive |
path | str, None | None | filepath to extract file into, default is current working directory |
members | List, str, None | None | list of files to extract from archive, by default all files in archive are extracted |
param archive_name: | |
---|---|
filename of the archive | |
param path: | filepath to extract file into, default is current working directory |
param members: | list of files to extract from archive, by default all files in archive are extracted |
return: | None |
This keyword supports extracting files from zip, tar and tar.gz archives.
By default file is extracted into current working directory, but path argument can be set to define extraction path.
Examples
Extract a file from archive into local directory
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
filename | str | null | name of the file to extract |
archive_name | str | null | filename of the archive |
path | str, None | None | filepath to extract file into, default is current working directory |
param filename: | name of the file to extract |
---|---|
param archive_name: | |
filename of the archive | |
param path: | filepath to extract file into, default is current working directory |
return: | None |
This keyword supports extracting a file from zip, tar and tar.gz archives.
By default file is extracted into current working directory, but path argument can be set to define extraction path.
Examples
Get information about the archive
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
archive_name | str | null | filename of the archive |
param archive_name: | |
---|---|
filename of the archive | |
return: | dictionary variable containing the keys filename, filemode, size, mtime, modified |
Returns following file attributes in a dictionary:
- filename
- filemode
- size
- mtime
- last modification time in format %d.%m.%Y %H:%M:%S
Examples
List files in an archive
Arguments
Argument | Type | Default value | Description |
---|---|---|---|
archive_name | str | null | filename of the archive |
param archive_name: | |
---|---|
filename of the archive | |
return: | dictionary variable containing the keys name, size, mtime, modified |
Returns list of files, where each file in a list is a dictionary with following attributes:
- name
- size
- mtime
- last modification time in format %d.%m.%Y %H:%M:%S