filesystemobject

JavaScript: Read files in folder

那年仲夏 提交于 2019-12-18 04:45:08
问题 EDIT: I'm trying to read all the files in a specific folder and list the files in there, not read the content of a specific file. I just tried to simply create an FileSystemObject and it doesn't do anything either. I show an alert (which pops up) beforfe making the FileSystemObject, and one after it (which isn't shown). So the problem is in simply creating the object. Original: I am trying to read all the files in a folder by using JavaScript. It is a local HTML file, and it will not be on a

Remove directory and it's contents (files, subdirectories) without using FileSystemObject

℡╲_俬逩灬. 提交于 2019-12-17 20:47:12
问题 I want to know if it's possible to rewrite this piece of code: Private Sub PrepareDir(ByVal dir As String) Dim fso As New FileSystemObject If fso.FolderExists(dir) Then Call fso.DeleteFolder(dir, True) Call fso.CreateFolder(dir) End Sub With VBA statements: Kill, MkDir, etc. Most "difficult" part of this - remove non-empty directory. With FSO it can be done easily, but how it can be done without FSO? 回答1: This piece of ccode uses RmDir to remove the Folder. AFAIK, RmDir cannot delete the

Directory file size calculation - how to make it faster?

社会主义新天地 提交于 2019-12-17 17:58:25
问题 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 approaches. Now the problem is, I have tens of thousands of files in a particular folder and its taking like atleast 2 minute to find the folder size. Also, if I run

Are there restricted characters in ADO varchars?

末鹿安然 提交于 2019-12-13 03:31:08
问题 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 rsf.Fields.Append "size", adInteger rsf.Fields.Append "date", adDate rsf.Fields.Append "type", adVarChar, 255 rsf.Open For Each oFile In oFolderContents if not left

What is “Dim fso, MyFile, FileName, TextLine” in VBA?

微笑、不失礼 提交于 2019-12-13 02:34:43
问题 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 = "c:\testfile.txt" Set MyFile = fso.OpenTextFile(FileName, ForReading) '' Read from the file Do While MyFile.AtEndOfStream <> True TextLine = MyFile.ReadLine ''

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

半腔热情 提交于 2019-12-12 17:32:52
问题 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, like writing out xml files or moving audio files. I have tried but failed to find any 'hard' documentation on this, and while my local dev box exhibits this

Write binary data with FileSystemObject write()

99封情书 提交于 2019-12-12 11:07:20
问题 I am developing a function in Javascript using FileSystemObject, where I just have to write in a file the binary data we are provided. This is my function. function exportFile(data) { var fso, f2; fso = new ActiveXObject("Scripting.FileSystemObject"); f2=fso.CreateTextFile("C:\\example.js",true); f2.Write(data); f2.Close(); } Nevertheless it doesn't always work (error on f2.Write(data)). I guess it is because one or both reasons: - Write function does not accept binary data (ASCII from 0-255)

Is using the windows scripting runtime, especially the FileSystemObject thereof a good idea?

我们两清 提交于 2019-12-12 09:46:14
问题 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 fact that the script host will be disabled on some users' computers? Update (aug 20, 2012): Since asking this question we have encountered the problem of a non

writing a query output to text file using FileSystemObject

一个人想着一个人 提交于 2019-12-12 03:19:26
问题 Is there a way to write a query output to a text file using FileSystemObject? 回答1: What's the format of the query results? you may be able to do something like this if it's a simple string, or you may have to extract the bits that you need. Here's the code to write a string to a text file using the filesystemobject: Const fsoForAppend = 8 Dim objFSO Dim queryResult queryResult = 'OMG no results' Set objFSO = Server.CreateObject("Scripting.FileSystemObject") 'Open the text file Dim

Query to Select All Non-Essential Temporary Files

蹲街弑〆低调 提交于 2019-12-12 02:06:37
问题 I am trying to write a script to delete unneeded temporary files. I am wanting to specifically target .tmp's, though. At least for now. So I am trying to write a WQL query to return a collection with which I can use a FOR EACH statement to delete all of the .tmp's in C:\Users\\AppData\Local\Temp. I've only recently started learning VBScript. But I have experience writing programs in C/C++ (mainly "math-y" programs). Cscript seems to have no problem with the query itself. But when I try to use