?
Solved

BATCH OR VB: SCAN HARD DRIVE FOR FILES, ZIP FOUND FILES, EMAIL ZIP FILE

Posted on 2008-11-12
1
Medium Priority
?
597 Views
Last Modified: 2013-11-10
I need a batch or VB script that will do the following:
   *Scan a hard drive for *.CFG files;
   *Zip those found files;
   *Email the zip file to an email address.

Any help would be appreciated!
0
Comment
Question by:LEECHIPTURNER
1 Comment
 
LVL 1

Accepted Solution

by:
lewismay earned 2000 total points
ID: 22949115
Hello,

Something like this might work

Depending on where you are emailing from you may need to configure the smtp server with something like: SmtpMail.SmtpServer = "mail.your-domain.com"
Dim message_object, shell
 
Set shell = CreateObject("WScript.Shell")
Set message_object = CreateObject("CDO.Message")
 
Call shell.Run("cmd /c dir /B /S c:\*.cfg | zip -@ c:\zip_file.zip", 0, true)
 
message_object.Subject = "subject" 
message_object.From = "name@domain.com" 
message_object.To = "name@domain.com" 
message_object.TextBody = "Text" 
message_object.AddAttachment "c:\zip_file.zip"
message_object.Send

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question