Solved

vbs script to read file and check if folder is there

Posted on 2011-09-29
1
360 Views
Last Modified: 2012-05-12
hello hope you can help me, I need vbs script to read file TXT or XLS and check if folder is there

if not it writes to a file...
0
Comment
Question by:James Murrell
1 Comment
 
LVL 7

Accepted Solution

by:
OklahomaDave earned 500 total points
ID: 36902734
You should take a look at instantiating a Scripting.FileSystemObject. It has built-in methods to check for folder and file existence, and to open text files. Here's a sample of how to check for the presence of a folder:

function doesFolderExist(folderName)

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
doesFolderExist = fso.FolderExists(folderName)

end function

You can also leverage the OpenTextFile method to read the TXT file. Reading .XLS files is a much more difficult task I'm not sure you really want to undertake in a VBScript file.

That should be enough to give you a push in the right direction. If you need further help, just post again and we'll go from there!

Good luck!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now