Automation Workshop helps to automate everyday tasks of any complexity. Do you need to watch some folder for changes? Execute the same backup process every other day? Process files based on their type or content? Something else…? Automation Workshop will hit the nail on the head!
Overview. There is a system (legacy DB with custom scripts) in place, which generates daily reports for many departments. Generated pdf's are satisfactory, however their naming (file name) provides little to no value, and is hard to manage in long term. Imagine thousands of files with the following naming scheme: report-id-department.pdf:
The goal. We will automatically convert file name and store these reports based on their creation date and department:
Solution. We are going to monitor a folder for any new PDF file using File watcher Trigger. The trigger will start a task, that will do the actual job - rename file using human readable file naming, while keeping the important details of original file name. Also, we will move the file to another location to allow easier file management.
First, use File / Folder watcher Trigger to monitor
C:\Input\Files\ folder. In the Filter tab set an include mask to required format, in our case,
report-*.pdf mask that will trigger the actual Task execution.
First, using Split text Action, we will tokenize monitored filename using dash character, to extract necessary parts from monitored file, namely id and department.
To automatically process every monitored file, specify Filename (without extension) using Variable Wizard - Triggers - File / Folder Watcher - Preset - Filename:
To simplify further task creation, give each token a custom name - Report, EntryID and Department respectively. Later in this Task, we will use these names for easy token (separated & tokenized text) access.
To capitalize the first letter of department token, use Change text case Action, and set case to Title Case:
As a text string to capitalize, choose Variable Wizard - Actions - Split text - Token 3 (with a custom name - Department):
Same length tokens are easier to overview and manage. To unify ID value (make it the same uniform length, regardless of its initial value), use Pad text Action - Pad with 0, and set total length to 10. As a text string specify Variable Wizard - Actions - Split text - Token 2 (with a custom name - EntryID):
Now we are ready to move watched file to the new location
D:\Output\To send\, and rename it according to our requirements. First, move file, using Move file Action. As a Source use Variable Wizard - Triggers - File / Folder Watcher - Preset - Full path and filename.
Custom variable names make a task management easier in future. Thus, before renaming a file, we will prepare 3 variables (My report, My date, My ID) using Set variable Action, each containing essential part of new file name. Variable My report contains Variable Wizard value - Actions - Change text case - New capitalized text. And simply the word - report.
Second variable My date contains 3 date components. They look the same, but are different inside:
Third variable My ID contains only one Variable Wizard value - Actions - Pad text - New padded text. This will make the final rename operation straight forward.
Finally, to rename file, use Rename file Action. As a source (Old name) use Variable Wizard value - Actions - Move file - Last destination file. For New name combine all 3 variables: My report My date - My ID and .pdf extension.
At this point Task is completed. It contains 1 Trigger - File / folder watcher, and 8 Actions - Split text, Change text case, Pad text, Move file, Set variable, Set variable, Set variable and Rename file:
Summary. From now on, any new PDF file in folder
C:\Input\Files\ matching mask report-anything.pdf automatically will be moved to folder
D:\Output\To send\, and will be smartly renamed, keeping the meaning of file. To make everything work automatically, and to pass data from one Action to another, we use Variable Wizard. Further, these newly renamed files are ready to be sent via email as attachments, or synced to storage / web server.
For example, see old name:
And notice the new one (the same file after smart renaming):
Now it is far easier to manage and overview PDF reports in a long term.
If you have any questions, please do not hesitate to contact our support team.