Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Next »

Table of contents:

 Click here to expand the table of contents

Description

This action is used to work with directories:

  • creature

  • copying

  • moving

  • removing

  • getting one or more files

  • checking directory existence

How to add an action to a project?

Via the context menu Add ActionDataDirectories

Or use smart search .

Where can the action be applied?

  • Retrieving a file from a directory (either in order or random):

    • file with the article for posting to the blog

    • picture for the avatar when registering on the forum

  • When parsing, you can create your own directory for each product where you can save pictures, descriptions and other necessary information

How to work with an action?

To work with directories, the following actions are provided, which are selected in the properties window:

Copy

This action allows you to copy a directory with all its contents to a new path.

Directory path

The path to the source folder is indicated here

New path

The path where you want to copy the directory

  • If the new path contains directories that do not exist, they will be created

  • If the directory on the new path exists, then nothing WILL BE COPIED, and the action will succeed (will be released on the green branch)


Move

Moving a directory along the specified path.

Directory path

The path to the source folder is indicated here

New path

The path where you want to copy the directory

  • If the new path contains directories that do not exist, they will be created

  • If the directory on the new path exists, then nothing WILL BE COPIED, and the action will succeed (will be released on the green branch)


Get the list of directories

This action allows you to get a list of all directories in the specified path.

Directory path

The path to the folder is indicated here

Search sub-directories:

  • if the checkbox is NOT CHECKED, then only those folders will be returned that are inside the directory along the path Path to the directory at the first nesting level

  • if the checkbox is CHECKED, an additional search will be performed in all subdirectories, regardless of their nesting level

Filter by mask

If this checkbox is checked, then in the field on the right you can enter a search mask , you can use several masks separated by the symbol |

The result of the work is saved to the list


Get file list

This action allows you to get a list of all files in the specified path.

Directory path

The path to the folder is indicated here

Search sub-directories:

  • if the checkbox is NOT CHECKED, then only those files will be returned that are inside the directory along the path Path to the directory at the first nesting level

  • if the checkbox is CHECKED, an additional search will be performed in subdirectories, regardless of their nesting level

Filter by mask

If this checkbox is checked, then in the field on the right you can enter a search mask , you can use several masks separated by the symbol |

The result of the work is saved to the list


Check directory existence

Thanks to this action, you can find out if the directory exists at the given path. If the directory is found, then the action will be released on the green branch (successful completion), if such a folder is not found, then on the red (error)

Directory path

This is the path to the folder, the existence of which must be checked

Timeout (in seconds)

If the action did not find the directory immediately, it will wait for its appearance for the specified amount of time


File path

This action allows you to get one file from the directory at the specified path.

Directory path

The path to the folder is indicated here

File

By number

You must specify a specific file number (numbering from zero)

Random file

A random path from the available ones will be returned.

Sort alphabetically

The description will appear later.

Search sub-directories:

  • if the checkbox is NOT CHECKED, then the file will be selected from those inside the directory along the path Directory path

  • if the checkbox is CHECKED - additionally, a search will be performed in subdirectories, regardless of their nesting level

Mask

If this checkbox is checked, then in the field on the right you can enter a search mask , you can use several masks separated by the symbol |

The result of the work is saved into a variable.


Create

Using this action, you can create a new directory in the path specified in the Directory path

If a directory already exists at the specified path, it WILL NOT be overwritten. The action will be released on the green thread (successful).


Remove

This action allows you to delete the folder specified in the Directory path field with all its contents. If you try to delete a non-existent folder, the action will still be released on the green branch.

The directories deleted in this way do not end up in the Trash, but are deleted irrevocably!


Usage example

Often, when registering on various resources, you need to upload an avatar. Let's imagine that you have a directory with prepared images, inside which there are files with different extensions (jpg, jpeg, png, tiff, etc.) and we need to select one. The resource on which you need to register requires that the uploaded files are only in PNG format. For this task, we will use the File path action and select a random file path. To select only PNG files, use the * .png mask

{-Project.Directory-} is a ProjectMaker system variable that stores the full path to the folder where the template file is located.

 After running this cube, the avatar variable will contain the absolute path to the file.


Search by mask

When searching by mask, you can use special characters:

  • ? - any one character other than a dot

  • * - any number of any characters

  • | - this symbol is used when you need to apply several masks at the same time (works only with files)

 Examples of

Any files with any extension

  • .*

Any files with any extension

  • .jpg

Files with the extension .jpg .

  • image.jpg

  • avatar.jpg

  • 1.jpg

  • .p*

Files whose extension begins with p .

  • document.pdf

  • presentation.ppt

  • document.project

  • 1.p

im *. *

Files with any extension, but whose name begins with im .

  • immature.jpg

  • impossible.ico

  • impatient.html

  • mat?.html

.html files whose name begins with any sequence of characters, then comes the mat part after which one character.

  • automate.html

  • tomato.html

  • mate.html

doc?????.xls

.xls file starting with doc followed by any 5 characters (except dot)

  • document.xls

  • doc-1208.xls

  • doctrine.xls

???.??

A file with three characters in the name and two in the extension.

?????

A file with five characters in the name and no extension.

  • house

  • image

  • tasks

  • .xlsx | *.docx

Any xlsx and / or docx document

  • invoice.docx

  • resume.docx

  • project.xlsx

  • default.xlsx

Original article


  • No labels