[Solved] Delete file task and email with attachments - VisualCron - Forum

Community forum

BobJ
  •  BobJ
  • Paid support Topic Starter
2014-07-30T13:06:36Z
Not sure if what I "want" to do is possible with VC:

1. We have two directories. Incoming files are stored by a separate application into Folder1. A VisualCron task watches for new files and copies them to Folder2. Staff access Folder2 to individually process the files. As each file is finished and deleted from Folder2, I'd like to delete the original/corresponding file from Folder1. The VC job I've set up ends up deleting all files from Folder1 when any file is deleted from Folder2. Is it possible to (through use of variables??) to have the delete job delete the specific file(s) from Folder1 that has been deleted from Folder2?

2. As files are initially added to Folder1, a separate VC job monitors that folder and sends an email to staff. The VC job attaches the new file to the email, however, there are two issues.

a. The job currently sends an email attaching ALL the files that exist in Folder1 - whether they are new or were already present. Is it possible to attach only "new" files in the email?

b. The current process only sends one email. So if three new files are received, it sends one email with all files in the folder attached. I'd like to have three separate emails - each with only one attachment (for each of the three new files detected). Is this possible to do this in VC?
Support
2014-07-30T15:34:23Z
Sure,

I think you should take a look at the File Trigger tutorial here . It covers the use of Variables so you can reference the new file that has been created. Both for copy, attach and later delete.

There are two interesting Variables as you will see. The folder path and file name. This can be passed on to other Tasks.

Please let us know if you have any further questions.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
DJPFrozenP
2014-07-30T15:35:06Z
You can use an Event Trigger to watch for a file that is deleted from 'Folder2'.

You can then use parameters to use the Trigger's filename in your delete of the file in 'Folder1'.

The Trigger files filemask will be:
{TRIGGER(Active|LastTrigger|File.Result.Name)}
BareVibeTing
DJPFrozenP
2014-07-30T15:37:29Z
I forgot to add - if you want 1 file per e-mail I would include this in the above job I described. Using the Trigger files will enable you to process in a file-by-file basis, rather than a batch basis.
BareVibeTing
BobJ
  •  BobJ
  • Paid support Topic Starter
2014-07-31T15:05:11Z
Okay - I was able to resolve my original problems - those are taken care of.

Now I have a rename issue. What I'm trying to do is watch Folder1 for new files and rename the file to include date/time to make the file name unique.

I found a post in the forum where someone was trying to do something similar - but specifically with .zip files. I want it to occur for all files - regardless of extension.

If I include this command in the post process mask, it WILL work with .zip files

{STRING(Replace|{NEWNAME()}|.zip|_{DATEFORMAT(yyyyMMdd-HHMMss)}.zip)}


If I change it to reference .txt files it works for those:

{STRING(Replace|{NEWNAME()}|.txt|_{DATEFORMAT(yyyyMMdd-HHMMss)}.txt)}

But how do I change this statement to rename a file with ANY extension? I've tried these statements but the rename occurs only when I focus the statement on specific file extensions.

{STRING(Replace|{NEWNAME()}|.*|_{DATEFORMAT(yyyyMMdd-HHMMss)}.*)}
{STRING(Replace|{NEWNAME()}|*.*|_{DATEFORMAT(yyyyMMdd-HHMMss)}*.*)}


What silly little thing am I missing? What's the correct syntax??? Thanks


Support
2014-07-31T18:43:25Z
For getting the extension:

{PATH(GetExtension|{PATH(GetExtension|C:\Program Files (x86)\VisualCron\VisualCronClient.exe)})}


Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
BobJ
  •  BobJ
  • Paid support Topic Starter
2014-07-31T22:00:26Z
I appreciate you supplying that code, but I don't understand what I'm supposed to do with it? Embed it it in the original command - in place of .zip? If that's the case, does that apply to the first '.zip' in the command or both references to '.zip'?

{STRING(Replace|{NEWNAME()}|.zip|_{DATEFORMAT(yyyyMMdd-HHMMss)}.zip)}
Support
2014-07-31T22:49:21Z
When I think of it I think it is a harder approach to use Post process functionality. Just use:

*{DATEFORMAT(yyyyMMdd-HHMMss)}.*

In the new file mask and uncheck "Post process".
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
BobJ
  •  BobJ
  • Paid support Topic Starter
2014-07-31T23:43:28Z
Works like a charm! Thanks!!
Scroll to Top