Solved

vbs script to read file and check if folder is there

Posted on 2011-09-29
1
367 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

742 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