Both sides previous revisionPrevious revisionNext revision | Previous revision |
transformations:filecommand [2018/08/13 21:57] – dmitry | transformations:filecommand [2021/07/17 15:40] (current) – craigt |
---|
===== File command ===== | {{ transformations:FileCommandAction.png}} |
| ====== FILE COMMAND ====== |
| Category: Workflow / External\\ |
| |
Category: Workflow / External | \\ |
| =====Description===== |
This transformation allows performing the following file operations: | This action can perform the following file operations: |
* Copy or move a file | * Copy or move file, or list of files |
* Rename or clone a file | * Rename or clone file |
* Delete file | * Rename a list of files |
| * Delete file or list of files |
* Create folder | * Create folder |
* Delete folder | |
* Clean folder (deletes files and, optionally, subfolders) | * Clean folder (deletes files and, optionally, subfolders) |
| * Delete folder |
* Zip file | * Zip file |
* Zip folder | * Zip folder |
* Unzip a file | * Unzip a file |
| |
File names and folders can be specified using a parameter. | \\ |
| =====Action settings===== |
| ^ Setting ^ Description ^ |
| |Commmand|Select the file/folder command to use. See the following tables for details of all commands.| |
| |
**Notes** | \\ |
| ====Copy/move file settings==== |
| **Description:** Copies or moves a file to a new location. The filename is retained. |
| ^Settings ^Description ^ |
| |Mode|Select whether to create a copy of the selected file or move it. Options: //Copy// or //Move//.| |
| |File path<sup>*</sup>|Enter or browse to the fully qualified path and filename of the source file.| |
| |Destination<sup>*</sup>|Enter or browse to the folder to copy or move the file to.| |
| |If the file doesn't exist|Select how EasyMorph will handle cases when the source file does not exist. Options: //Do nothing// or //Halt project execution// (the workflow stops processing and displays an error).| |
| |If a file with such name already exists|Select how EasyMorph will handle saving the file if a file with the same name exists in the destination folder. Options: //Overwrite//, //Rename the existing file//, or //Halt project execution//. See the "File already exists" table below.| |
| <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
| |
| \\ |
| ====Copy/move list of files settings==== |
| **Description:** Copies or moves the files listed in a table column to another folder. |
| ^Settings ^Description ^ |
| |Mode|Select whether to create a copy of the source files or move them. Options: //Copy// or //Move//.| |
| |File paths|Select the column containing the fully qualified paths and filenames of the files to be copied or moved.| |
| |Destination<sup>*</sup>|Enter or browse to the folder to copy or move the files to.| |
| |If a file with such name already exists|Select how EasyMorph will handle saving the file if a file with the same name exists in the destination folder. Options: //Overwrite//, //Rename the existing file//, or //Halt project execution//. See the "File already exists" table below.| |
| <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
| |
| \\ |
| ====Rename/clone file settings==== |
| **Description:** Renames or creates a copy of a file with a new name ("clone"). Cloned files are created in the same folder as the source files. |
| ^Settings ^Description ^ |
| |Mode|Select whether to rename the selected file or copy it with a new name ("clone"). Options: //Rename// or //Clone//.| |
| |File path<sup>*</sup>|Enter or browse to the fully qualified path and filename of the source file.| |
| |New name<sup>*</sup>|Enter the new name for the file.| |
| |If the file doesn't exist|Select how EasyMorph will handle cases when the source file does not exist. Options: //Do nothing// or //Halt project execution// (the workflow stops processing and displays an error).| |
| |If a file with such name already exists|Select how EasyMorph will handle saving the file if a file with the same name exists in the destination folder. Options: //Overwrite//, //Rename the existing file//, or //Halt project execution//. See the "File already exists" table below.| |
| <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
| |
| \\ |
| ====Rename list of files settings==== |
| **Description:** Renames files listed in a table column with new names from a second column. |
| ^Settings ^Description ^ |
| |File paths|Select the column containing the fully qualified paths and filenames of the files to be renamed.| |
| |New names|Select the column containing new file names.| |
| |If a file with such name already exists|Select how EasyMorph will handle saving the file if a file with the same name exists in the destination folder. Options: //Overwrite//, //Rename the existing file//, or //Halt project execution//. See the "File already exists" table below.| |
| <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
| |
| \\ |
| ====Delete file settings==== |
| **Description:** Deletes the target file. |
| ^Settings ^Description ^ |
| |File path<sup>*</sup>|Enter or browse to the fully qualified path and filename of the source file.| |
| |If the file doesn't exist|Select how EasyMorph will handle cases when the source file does not exist. Options: //Do nothing// or //Halt project execution// (the workflow stops processing and displays an error).| |
| <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
| |
| \\ |
| ====Delete list of files settings==== |
| **Description:** Deletes multiple files listed in a table column. |
| ^Settings ^Description ^ |
| |File paths|Select the column containing the fully qualified paths and filenames of the files to be deleted.| |
| |If the file doesn't exist|Select how EasyMorph will handle cases when the source file does not exist. Options: //Ignore// or //Halt project execution// (the workflow stops processing and displays an error).| |
| <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
| |
| \\ |
| ====Create folder settings==== |
| **Description:** Creates a new folder. |
| ^Settings ^Description ^ |
| |Folder name<sup>*</sup>|Enter the name of the new folder.| |
| |Parent folder<sup>*</sup>|Enter or browse to the folder the new folder will be created within.| |
| |If a folder with such a name already exists|Select how EasyMorph will handle cases when a folder with the same name already exists in the selected parent folder. Options: //Fail// (the workflow stops and displays an error) or //Do nothing//.| |
| <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
| |
| \\ |
| ====Clean folder settings==== |
| **Description:** Deletes all files in the selected folder. If selected, subfolders can also be cleaned, or deleted. |
| ^Settings ^Description ^ |
| |Folder<sup>*</sup>|Enter or browse to the folder to clean.| |
| |Subfolders|Select what action to take on subfolders under the selected folder. Options: //Delete// (delete all subfolders), //Clean recursively// (delete files within all subfolders, at all levels), or //Do nothing//.| |
| <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
| |
| \\ |
| ====Delete folder settings==== |
| **Description:** Deletes the target folder. |
| ^Settings ^Description ^ |
| |Folder<sup>*</sup>|Enter or browse to the folder to delete.| |
| |If folder doesn't exist|Select how EasyMorph will handle cases when the folder is not found. Options: //Fail// (the workflow stops and displays an error) or //Do nothing//.| |
| <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
| |
| \\ |
| ====Zip file settings==== |
| **Description:** Creates a compressed zip file from the selected file. |
| ^Settings ^Description ^ |
| |File<sup>*</sup>|Enter or browse to the fully qualified path and filename of the source file.| |
| |Archive<sup>*</sup>|Enter or browse to the fully qualified path and filename of the resultant zip file.| |
| <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
| |
| \\ |
| ====Zip folder settings==== |
| **Description:** Creates a compressed archive of all files in the selected folder. |
| ^Settings ^Description ^ |
| |Folder<sup>*</sup>|Enter or browse to the folder to compress.| |
| |Include folder itself|The selected folder will be included in the resultant zip file. Otherwise, the zip file will only contain the files within the selected folder.| |
| |Archive<sup>*</sup>|Enter or browse to the fully-qualified path and filename of the resultant zip file.| |
| <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
| |
| \\ |
| ====Unzip archive settings==== |
| **Description:** Decrompresses and saves the folders and files within the selected zip file. |
| ^Settings ^Description ^ |
| |Zip archive<sup>*</sup>|Enter or browse to and select the zip file to decompress.| |
| |Target folder<sup>*</sup>|Enter or browse to the folder save the decompressed files to.| |
| |Create the folder if it doesn't exist|Check this option to create the named //Target folder// if it does not exist. | |
| |If any file with such name already exists|Select how EasyMorph will handle saving a file if a file with the same name exists in the destination folder. Options: //Overwrite//, //Rename the existing file//, or //Halt project execution//. See the "File already exists" table below.| |
| <sup>*</sup> Setting can be specified using a [[:parameters|parameter]].\\ |
| |
| \\ \\ |
| ====File already exists options==== |
| ^Option ^Description ^ |
| |Overwrite|The new file replaces the original file.| |
| |Rename the existing file|The original file will be renamed with "backup" and a serial number appended to the file name. The new file will\\ possess the original filename.| |
| |Halt project execution|The project will stop processing and this action will display an error.| |
| |
| |
| \\ |
| =====Remarks===== |
Unzipping password-protected archives is not supported. | Unzipping password-protected archives is not supported. |
| |
More complex file operations can be implemented using Windows shell commands in the [[transformations:runprogram|Run program]] or [[transformations:iterateprogram|Iterate external program]] actions. | More complex file operations can be implemented using Windows shell commands in the [[transformations:runprogram|Run program]] or [[transformations:iterateprogram|Iterate external program]] actions. |
| |
| \\ |
| =====Community examples===== |
| * [[https://community.easymorph.com/t//1629/2|In case, no file to load]] ([[https://community.easymorph.com/uploads/short-url/4OREDaUn1vdfwxKOGmMoLXAl7CB.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Delete, if exists//; Action position: //2//) |
| * [[https://community.easymorph.com/t//1769/1|How to do recursive loops in EasyMorph]] ([[https://community.easymorph.com/uploads/short-url/qM6kmqrDRWiEDJFljIa2u6QWre1.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Loop//; Action position: //5//) |
| * [[https://community.easymorph.com/t//2653/1|Extracting all projects published in the Community and their actions]] ([[https://community.easymorph.com/uploads/short-url/mrnJQUJJL8Do1T8ioicyzE1VgmK.morph|Project]]; Module: //Download & parse//; Group: //Group 1//;\\ Table: //Delete temp file//; Action position: //2//) |
| |
| \\ |
| =====See also===== |
| |
| * [[transformations:runprogram|Run program]] |
| * [[transformations:iterateprogram|Iterate external program]] |
| |