DavidSCowan
Board Regular
- Joined
- Jun 7, 2009
- Messages
- 78
Can someone help me please.
I am trying map out my hard drive – which files are in which folder, folder sizes etc.. This requires that I access folders.
The problem is that if the folder attribute is not normal i.e. folder.attribute is not =0 then when the procedure runs I get: Run-time error ‘70’: permission denied.
When the folder isn’t normal what I want to do is to change the folder attribute from Read-Only = 1, Hidden = 2 (or one of the many other numbers), carry out the procedure and then reset the original attribute after the procedure .
The problem is that when I try to do this I again get “Run-error ‘70’: permission denied”!
The relevant part of the procedure is:
Dim apexfolder as scripting.folder
Set apexfolder = fso.GetFolder(FolderToSearch)
folderType = apexfolder.Attributes ‘This is to reset the folder attribute back to what it was later
If folderType = 0 Then
'Do nothing
Else
apexfolder.Attributes = 0 ‘Here I am trying to set the folder type to normal but this generates Run-time error 70
THE PROCEDURE
apexfolder.Attributes= folderType 'resetting back to the original type
Any thoughts gratefully received.
With kind regards
David
I am trying map out my hard drive – which files are in which folder, folder sizes etc.. This requires that I access folders.
The problem is that if the folder attribute is not normal i.e. folder.attribute is not =0 then when the procedure runs I get: Run-time error ‘70’: permission denied.
When the folder isn’t normal what I want to do is to change the folder attribute from Read-Only = 1, Hidden = 2 (or one of the many other numbers), carry out the procedure and then reset the original attribute after the procedure .
The problem is that when I try to do this I again get “Run-error ‘70’: permission denied”!
The relevant part of the procedure is:
Dim apexfolder as scripting.folder
Set apexfolder = fso.GetFolder(FolderToSearch)
folderType = apexfolder.Attributes ‘This is to reset the folder attribute back to what it was later
If folderType = 0 Then
'Do nothing
Else
apexfolder.Attributes = 0 ‘Here I am trying to set the folder type to normal but this generates Run-time error 70
THE PROCEDURE
apexfolder.Attributes= folderType 'resetting back to the original type
Any thoughts gratefully received.
With kind regards
David