2

I'm trying to get the folder size of a folder that is over 2.5TB's large. I'm getting the following error - "The File or Directory is Corrupted and Unreadable", yet I can access the folder fine from windows.

The folder is not located on my computer if that means anything, its located on my companies server.

Here's my code

Const dirPath     = "\\CSSFile-01.epicgames.net\Orion"
Set FSO = CreateObject("Scripting.FileSystemObject")
dirSize = FSO.GetFolder(dirPath).Size

There's a whole bunch more code but the dirSize is the line i get the error on. Can vbscript just not run scripts on folders that long?

user692942
  • 16,398
  • 7
  • 76
  • 175
Khakis7
  • 413
  • 4
  • 19
  • Does it work on smaller folders? Anyway, [this might help](https://blogs.technet.microsoft.com/heyscriptingguy/2004/11/18/can-i-use-a-script-to-determine-the-size-of-a-folder-on-a-remote-computer/) (second half discussing potential problems with such script) – Revolver_Ocelot Feb 26 '16 at 16:22
  • Accessing the folder from Windows is not a true like for like test. Do as @Revolver_Ocelot has suggested and run the script against a smaller folder both locally and remotely. If I was to guess I think the problem is with calling the folder remotely and a lack of permission that moonlights as a `The File or Dictionary is Corrupted and Unreadable` error. It's not uncommon for VBScript errors to report one thing and mean another. Testing locally would definitely go some way to debugging the problem. – user692942 Feb 26 '16 at 16:37
  • I've tested in on a smaller folder located on my desktop and it works perfectly. I don't have write permission to the folder I'm trying to read, do you think that could cause the problem? – Khakis7 Feb 26 '16 at 20:51
  • It's probably not `write` permission explicitly but more likely a related permission such as `List folder contents` etc. Either way `read` is probably not enough. – user692942 Feb 26 '16 at 21:01
  • I currently have read access to the file, which from my understanding overrides List folder contents, and am getting write permission now. Am I wrong on this and should be trying to get List folder contents permission too? – Khakis7 Feb 26 '16 at 21:28
  • I read the original link by Revolver and it says I can use this line to access remote folders \\atl-ws-01\C$\, how would I change this for the CCSFile-01? Would I just add a $ at the end? – Khakis7 Feb 26 '16 at 21:50
  • Although the remote path looks like a valid UNC path I doubt that `\\CSSFile-01.epicgames.net\Orion` points to a file share on a machine inside a domain you own, it's more likely that `CSSFile-01.epicgames.net` is a web URL am I right? – user692942 Feb 27 '16 at 00:53

0 Answers0