Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8084733
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:53:08+00:00 2026-06-05T17:53:08+00:00

I have a script that obtains information about the current folders and subfolders within

  • 0

I have a script that obtains information about the current folders and subfolders within a specific directory. It works great, but I have stumbled across a strange issue:

dim FSO, objFolder, datafolder, foldername, objSubfolder, totalSize
dim objSubfolder2, objFolder2, mSize, size, today, dateLastMod

foldername = "D:\folder\subfolder"
set FSO = CreateObject("Scripting.FileSystemObject")
set objFolder = FSO.GetFolder(foldername) 
set colSubfolders = objFolder.Subfolders
today = Now
ShowFolderDetails objFolder

Function ShowFolderDetails(oF)

    datafolder = oF.Size/1073741824
    wscript.echo oF.Name & " :Size= " & datafolder & " GB"
    wscript.echo oF.Name & " #Files= " & oF.Files.Count
    wscript.echo oF.Name & " #Folders= " & oF.Subfolders.count
    wscript.echo oF.Name & " Date Last Modified= " & oF.DateLastModified
    totalSize = totalSize + datafolder

end Function

And there is more to follow, but my issue is I get a path not found when I call that function.

The folder is not located on the C:\ drive – which shouldn’t be an issue.
I have done this same script but changed foldername = D:\folder\differentsubfolder which works perfectly. But when I change it back to the other folder, it gives me a path not found error.

I also tried putting everything below set FSO = CreatObject(“Scripting.FileSytemObject”) within an IF statement:

IF FSO.FolderExists(foldername) Then ….

This does enter in that IF statement, which makes me believe the VBS sees it, but I still get that error at line 17 (datafolder = oF.Size/1073741824).

I have tried putting in the full folder path where the variable foldername is located (surrounded in quotes).

I tried running my vbs pointed to other directories and it runs 100%. Its just that specific folder. There are no spaces in the folder name.
Is there anything else I am missing? I have full admin access to the D:\

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:53:11+00:00Added an answer on June 5, 2026 at 5:53 pm

    I bet it isn’t a hidden file or folder that is the cause but a system file like eg Thumbs.db thas sits in many folders containing images, too see them edit your folder options to see systemfiles, remove the systemfile and try again. When you ask the size of a folder you need access to ALL folders and files beneath it. If you try your script on eg your profilefolder you certainly will get errors, administrator or owner of that folder or not.

    In case it could help, here a script that gives the attributes from a file

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.GetFile("c:\ruby193.zip")
    If objFile.Attributes AND 0 Then
        Wscript.Echo "No attributes set."
    End If    
    If objFile.Attributes AND 1 Then
        Wscript.Echo "Read-only."
    End If    
    If objFile.Attributes AND 2 Then
        Wscript.Echo "Hidden file."
    End If    
    If objFile.Attributes AND 4 Then
        Wscript.Echo "System file."
    End If    
    If objFile.Attributes AND 32 Then
        Wscript.Echo "Archive bit set."
    End If    
    If objFile.Attributes AND 64 Then
        Wscript.Echo "Link or shortcut."
    End If    
    If objFile.Attributes AND 2048 Then
        Wscript.Echo "Compressed file."
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a script that is trying to compare specific data based on a
I have a js script that reads and parses XML. It obtains the XML
I have a script that creates a random string and I want to turn
We have a script that saves some rows in a table and one of
I have a script that evokes a for loop with a set number of
I have a script that pulls data from a database, and based on the
I have a script that is supposed to read from the database and return
I have a script that I would like to convert to a module and
I have a script that is symlinked from one folder to another /var/www/default/index.php which
I have a script that gets results from a mySQL database and then outputs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.