File operations

With EasyMorph you can perform common file operations in a fast and visual way using the "File command" action. As with other actions, the action's commands can be configured using parameters. As of now the following commands are available:

  • Copy/move file
  • Copy/move list of files
  • Rename/clone file
  • Rename list of files
  • Delete file
  • Delete list of files
  • Create folder
  • Clean folder
  • Delete folder
  • Zip file
  • Zip folder
  • Unzip archive

Notice that some commands deal with one file (or folder) and some operate with multiple files using lists of files. Let's take a close look at the difference between them.

Single file/folder operations

When a command operates with one file or folder the file name(s) can be specified either explicitly, or using a parameter. In the screenshot below the "Copy/move file" command is configured using a file name explicitly (MyData.xlsx), and a folder path using a parameter (Target folder).


Operations with a list of files

Some of the commands above operate with a list of files. A list of files in this case is a column which values are full file paths. It's a convenient way to manipulate multiple files at once without using iterations.

To use a file command with a list of files, the list has to be produced first. Most frequently, the list is produced using the "List of files" action, and then filtered using various filtering actions if necessary. In the screenshot below, the initial list of files generated using the "List of files" action, and then filtered using two filtering actions. The first filter keeps only files with extensions ".xlsx" and the second keeps only files which names are numerical using an expression.


Once a required list of files is produced, use the necessary file command and specify the column that contains the list of files in the action's input dataset.


Example: a project that deletes all .PDF files from the user's desktop: clean-desktop.morph.


Read next: Executing external programs and scripts