Questions tagged [filesystemobject]

Object Model component on Windows systems that represents the local file system.

The FileSystemObject (FSO) Object Model is used to access the local file system. Among other things, it provides methods for

  • reading file properties
  • creating and deleting files and folders
  • reading from files

For a complete list, visit the documentation link below.

Questions using the tag are expected to relate to programming

Links:

343 questions
123
votes
5 answers

How do I use FileSystemObject in VBA?

Is there something that I need to reference? How do I use this: Dim fso As New FileSystemObject Dim fld As Folder Dim ts As TextStream I am getting an error because it does not recognize these objects.
Alex Gordon
  • 57,446
  • 287
  • 670
  • 1,062
47
votes
2 answers

Loop Through All Subfolders Using VBA

I'm looking for a VBA script that will loop through all subfolders of a specified folder. When I say all subfolders, I mean each folder inside the specified folder, and each folder inside of that, and each folder inside of that...in theory there…
Jake
  • 893
  • 2
  • 9
  • 17
25
votes
4 answers

ActiveXObject in Firefox or Chrome (not IE!)

I am trying to create an ActiveXObject (to use FileSystemObject) but it's only supported in IE. Is there a way I can make it work in Chrome or Firefox? I need to read all the files in a specific given folder, and list those. Well, is there another…
Tjekkles
  • 5,352
  • 8
  • 36
  • 53
20
votes
8 answers

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…
Jey Geethan
  • 2,235
  • 5
  • 33
  • 60
12
votes
2 answers

JavaScript: Read files in folder

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)…
Killerwes
  • 292
  • 1
  • 4
  • 14
10
votes
3 answers

Error: ActiveX Component Can't Create Object Scripting.FileSystemObject

I have a simple vbs-file on my drive c: with following content: Set objShell = CreateObject("Scripting.FileSystemObject") When I'm trying to launch it, I get error c:\fso.vbs(1, 1) Microsoft VBScript runtime error: ActiveX component can't …
vmg
  • 9,920
  • 13
  • 61
  • 90
9
votes
3 answers

Access files with long paths (over 260)

I'm using Microsoft Scripting Runtime (FSO) to parse folders and produce a list of all of its contents, the folders are on a network and resultant paths end up longer than 260. The minimum code I have is as below:- Private Sub ProcessFolder(ByVal…
Gary Evans
  • 1,850
  • 4
  • 15
  • 30
8
votes
3 answers

If file exists then delete the file

I have a vbscript that is used to rename files. What I need to implement into the script is something that deletes the "new file" if it already exists. For example: I have a batch of files that are named like this 11111111.dddddddd.pdf where the…
CLO_471
  • 125
  • 2
  • 4
  • 12
8
votes
3 answers

Excel VBA efficient get file names function

I need to get a collection of file names from a folder on a remote server using VBA in excel 2010. I have a function that works and in the majority of cases it would do the job, however the remote server frequently has terrible, terrible network…
Coder375
  • 1,535
  • 12
  • 14
8
votes
1 answer

How to use FileSystemObject to read file in JavaScript

I want to read a file with FileSystemObject. My code is as following: Read json