directories info??

English support forum

Moderators: white, Hacker, petermad, Stefan2

User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

Cool CoolWater ;) :lol:
Thx

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
User avatar
Clo
Moderator
Moderator
Posts: 5731
Joined: 2003-12-02, 19:01 UTC
Location: Bordeaux, France
Contact:

Fine, but network issue

Post by *Clo »

2CoolWater
:) Hello !
• Thanks, it works fine as recursive. I added it in the French forum.
:| However, a weird issue :
- in the network, when I display a XP-Pro workstation - all displayed dirs are shared, indeed -, it works for some dirs, while I get an error message for some others; something like :

Code: Select all

"Access denied "
Line : 21
Char. : 5
Code : 800A0046
 Running error MS VB-Script
- This is specially for a whole shared HD (storage only, not system)

:?: Any idea ?

:mrgreen:  Kind regards,
Claude
Clo
#31505 Traducteur Français de TC French translator Aide en Français Tutoriels Français English Tutorials
CoolWater
Power Member
Power Member
Posts: 738
Joined: 2003-03-27, 16:33 UTC

Post by *CoolWater »

2Clo

Hello,

well, the problem should be the "System Volume Information" folder...
to avoid this error message, just add to following line at the beginning of the script:

Code: Select all

On Error Resume Next
which means: ignore all errors, so the script is not terminated in case of any error. "dirty hack" but in this case i don't think further error handling is needed ;)

Regards,
CoolWater
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

CoolWater wrote:well, the problem should be the "System Volume Information" folder...
Or you take possesion of the folder with 'cm_EditOwnerInfo'. That may help to have the right to access this folder.

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
User avatar
Clo
Moderator
Moderator
Posts: 5731
Joined: 2003-12-02, 19:01 UTC
Location: Bordeaux, France
Contact:

Patched by Paul V.

Post by *Clo »

2Sheepdog & 2CoolWater

:) Hello !

• The user Vansumsen has patched alright the original script, to avoid these denied accesses errors. Below is the Paul's version :

Code: Select all

Set objArgs = WScript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject") 
SubDirCount = 0 
CountRefused = 0 
Refused = ""
 
For I = 0 to objArgs.Count - 1 
   If fso.folderExists( objArgs(I) ) then 
      Set folder = fso.GetFolder(objArgs(I)) 
      LastPart = Mid(folder, InStrRev(folder, "\") + 1) 
      RecurseFolder folder, fso 
      If CountRefused <> 0 then
         Refused = Chr(10) & Chr(13) & "Plus " & CountRefused & " which the access is denied by Windows !"
      else
         Refused = Chr(10) + Chr(13) + "None access has been denied by Windows"
      end if
      If LastPart <> "" then
         Call MsgBox("The number of sub-dirs. in the active dir. '" + LastPart + "' is: " & SubDirCount & Refused , 64, folder)
      else
         Call MsgBox("The number of dirs. and sub-dirs in the active drive is: " & SubDirCount & Refused , 64, folder)
      End If
   End If 
Next 
 
Sub RecurseFolder(sPath, fso) 
   Dim fFolder, fSubFolders, fSubFolder 
   Set fFolder = fso.GetFolder(sPath)
   Set fSubFolders = fFolder.SubFolders 
    On Error Resume Next
    'Now recurse for each subfolder in the sPath folder... 
    For Each fSubFolder In fSubFolders 
        '*** Call self to recurse down folders 
        Call RecurseFolder(sPath & "\" & fSubFolder.name, fso)
 If Err.Number <> 0 Then 
  CountRefused = CountRefused + 1
 Else
  SubDirCount = SubDirCount + 1 
 End If
    Next 
End Sub 
 
'Original by W!ke76(http://www.eforum.de/showthread.php?s=&threadid=1356)
'Patched by «Le ouistiti»
:wink: It works fine in my LAN for the NTFS shared drive/dirs. which caused an error before from a Win 98SE reading…

:mrgreen: Kind regards / VG
Claude
Clo
#31505 Traducteur Français de TC French translator Aide en Français Tutoriels Français English Tutorials
Post Reply