Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


smercer
2012-10-15T17:59:18Z
Is it possible to do a directory listing and have the output e-mail to a specified recipients?

Thanks,
Scott
Sponsor
Forum information
bbusse
2012-10-15T18:36:25Z
Originally Posted by: smercer 

Is it possible to do a directory listing and have the output e-mail to a specified recipients?

Thanks,
Scott



Yessir, it is. As long as you just want something simple such as all the files in c:\Windows\ listed (no details, etc... just the listing of files.

1. Create a new blank Job
2. Create a new Task, "List File(s)" is the task type.
3. Under the list files tab for "Folder" specify the folder you want to look in
4. Also under the list files tab, if you want to only look at *.TXT change the "Include File Mask" to *.TXT intead of * By default it will list ALL files.
5. Save the List Files task. Go ahead and run that task, you'll see the "Output" will now have a list of files it saw in the directory.

We're going to use the Output from that task to send an e-mail.

6. Create a 2nd task (named whatever you like) and select "Email" as the task type. (I'm assuming you already have a connection created for sending e-mail in general)
7. Under the EMail Tab, select "Text" from the lower row of tabs.
8. In the box where you can enter text, enter the following:

{TASK(PrevTask,StdOut)}

What that does is, it uses the output from the previous task as the body of the e-mail. This does assume the 'List Files' task ran immediately before the e-mail task, as in "List Files is Task #1, and Send E-mail is Task #2"

Brian
smercer
2012-10-15T19:44:13Z
Awesome.... That works.... Now to be really technical, is there a way to get the dates and times associated with each file and directory???
bbusse
2012-10-15T20:05:53Z
Originally Posted by: smercer 

Awesome.... That works.... Now to be really technical, is there a way to get the dates and times associated with each file and directory???



Someone else may have to chime in, but I do not see a way natively do do that.

HOWEVER, VisualCron gives you MANY options :)

Instaed of a 'List Files' task you could do a 'PowerShell' task and paste this code (substitute c:\windows for the folder you want) into the powershell code area of the task.
gci c:\windows | select Name, LastWriteTime,Length | ConvertTo-Html -fragment

What that does is gets the Name, Last modified date, and size. Then converts the output to HTML. All this will end up in the tasks Output, as before.

Then, on your E-mail task, On the "Main Settings" tab, check the box for 'Send HTML" and move the variable from 'Text' to 'HTML"

{TASK(PrevTask,StdOut)}


Try that :)

Brian
Support
2012-10-16T06:29:04Z
Right, you cannot get dates just natively out of VisualCron. You need to create .NET code task, powershell or run any script through Execute Task that picks up everything you need to have.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top