filesystemobject

Exclusive File access to logfile with VBScript and Filesystemobject

Need help with this one. I have a VBS script that currently writes to a logfile. This script can be kicked off my multiple simultaneous processes so now I'm worried about concurreny. I'm currently using the FilesystemObject to open and write to this file. Does FSO support exclusive file access? Thanks in Advance ...

Are there restricted characters in ADO varchars?

We have a simple file browser on our intranet, built using ASP/vbscript. The files are read by the script and added to an ADO Recordset (not connected to a database), so we can sort the contents easily: Set oFolderContents = oFolder.Files Set rsf = Server.CreateObject("ADODB.Recordset") rsf.Fields.Append "name", adVarChar, 255 r...

ASP FileSystemObject collection cannot be accessed by index

Am I going mad? I cannot find a way to get hold of the first file in a folder with the FileSystemObject (classic ASP). With most collections you'd think the index 0 or 1 might work, but IIS says "Invalid procedure call or argument". Neither of these last 2 lines work: Set oFileScripting = CreateObject("Scripting.FileSystemObject") Set ...

Can't write file in classic asp

Ok, it's been a while since I've worked with classic asp so I'm a bit rusty. Here's my question. I'm trying to write a file to the file system using FSO. The code below is very simple. However, the file is not appearing and no errors are appearing. I know it's running the code because I can add response.writes before and after this snip...

Truncated files when copying CSV files using FileSystemObject

I am helping my son write a program to format files to load into another system. I have done this before with no trouble. Now I get a 13 KB comma delimited text file and I am copying it use FSO to another file with a csv extension. For some reason the new file always stops at the same place, about6 records from the end of the file ori...

Delete a chosen line from a text file using ASP?

I have a loop that finds duplicate lines in a .ini file. I can happily find the duplicate lines, and write new lines to the file using FileSystemObject, however... I can't seem to find out how to delete the duplicate lines. What I want to do is delete the lines by line number as I have identified the relevant line number already. Is th...

Gadget, Write Unicode Data in XML

Hello I want in Gadget, Write Unicode data in XML File(I use UTF-8 to encode the XML document). for Write to XML, Use " fso = new ActiveXObject("Scripting.FileSystemObject"); ". But after Write, data not Unicode. In Addition, I need Data as Unicode. Thanks ...

What's the .Net replacement for File.Type FileSystemObject property?

In classic Asp we used the File.Type property to get the friendly name associated with a file type from the registry (e.g. "Text Document" for ".txt"). The FileInfo class which generally replaces the old COM object doesn't replicate this feature and so far I'm not having much success in my search of a replacement. ...

Classic ASP: Best way to read & write large (5mb+) files using FileSystemObject

All, I'm working on an application that allows authorized users to upload Excel spreadsheets to our server. Once they're uploaded, there's a classic ASP script that reads the data in the Excel spreadsheet, does a bunch of validation, parsing, and manipulation, then writes the modified data to a tab-delimited text file. Then, it kicks ...

What is "Dim fso, MyFile, FileName, TextLine" in VBA?

I received this code from one of those nice people here who are willing to spend their time and energy to share their knowledge with noobs: Sub ReadLinesFromAFileOneAfterAnother () Const ForReading = 1, ForWriting = 2, ForAppending = 8 Dim fso, MyFile, FileName, TextLine Set fso = CreateObject("Scripting.FileSystemObject") FileName = ...

Getting the size of a remote folder via classic ASP

I'm trying to something pretty simple but am having headaches with it. I'm pretty sure all I have here is a permissions issue I don't know how to solve but I could be wrong. Here is my scenario... I have 3 servers... Server A - Web Server (Windows 2003) - Anonymous Access Enabled Server B - Red 5 Media Server Server C - NAS The webs...

VBScript's CopyFile not working

I think it may have something to do with the external file but I am getting the error Path not found and don't know why. Code below. <% Dim fs set fs = Server.CreateObject("Scripting.FileSystemObject") fs.CopyFile "http://domain.com/file.xml","softvoyage.xml" set fs = Nothing %>DONE. ...

Scripting.Filesystemobject filemove, writefile not working from javascript in IE browser (workarounds, doc?)

I know it's a huge security hole to use Scripting.Filesystemobject from javascript in the browser. I heard a rumor that MS is locking down this hole in the latest version of Office. This would be bad news for the enterprise web app I am working on, which has a few critical functions which depend on access to Scripting.Filesystem object...

Alternative to Server.CreateObject

I am writing a navigation system in classic ASP (on Windows CE). I require a way to dynamically include navigation files based on the calling script. I have come up with the following code that includes nav.inc that is located in the folder of the calling script to allow different folders to have different navigational features. This wo...

VBScript Catching Erroring Varialble Value

I have a VB Script (.vbs file) that is just a simple directory listing of a drive. It will the base of a drive back up script. But when running it as it is below, I am getting a Permission Denied error on some folder. What I need to find is what that folder is so I can figure out what the problem is with the folder. The line that is giv...

File permissions with FileSystemObject - CScript.exe says one thing, Classic ASP says another...

I have a classic ASP page - written in JScript - that's using Scripting.FileSystemObject to save files to a network share - and it's not working. ("Permission denied") The ASP page is running under IIS using Windows authentication, with impersonation enabled. If I run the following block of code locally via CScript.exe: var objNet = n...

Is using the windows script host, especially the FileSystemObject hereof a good idea?

Recently I have been asked to do some maintenance on a VB6 application. This involves some file IO. I find the IO operations offered by referencing the windows script host and using the FileSystemObject a lot friendlier than the IO operations that come with VB6. But will this cause problems because of security issues, or because of the ...

Directory file size calculation - how to make it faster?

Using C#, I am finding the total size of a directory. The logic is this way : Get the files inside the folder. Sum up the total size. Find if there are sub directories. Then do a recursive search. I tried one another way to do this too : Using FSO (obj.GetFolder(path).Size). There's not much of difference in time in both these approache...

VBA or Vb Scripting: how to write to a file in Unicode using FileSystemObject

How would you use FileSystemObject to write to a string to a file in Unicode? ...

What do the enum values of objLogicalDisk.DriveType in vbscript refer to?

Hi, so the following code: Dim objFSO : Set objFSO = CreateObject("Scripting.FileSystemObject") Dim colDrives : Set colDrives = objFSO.Drives Dim objWMIService : Set objWMIService = GetObject("winmgmts:") Dim objLogicalDisk Dim objDrive For Each objDrive in colDrives Set objLogicalDisk = objWMIService.Get("Win32_LogicalDisk.Devic...