Hi.
I'm a new VBscripter, so probably this my question may be a little stupid.
I'm trying to create a simple 'batch' file to copy files from CD to
hard-disk. The problem is that the files on hard disk will have the ReadOnly
flag set.
I tryed the following code (recursive to run on subfolders too), but it
don't work. I call it with WSCRIPT.
Can someone help me ?
Thank You very much.
Alberto.
' Main call
call VBS_ClearReadOnlyFlag ("C:\FOLDER_EXAMPLE")
' Subroutine
Sub VBS_ClearReadOnlyFlag (szFolder)
Dim oFolder, oSubFolder, oFiles, f, f1
' Check if folder exist
If (oFS.FolderExists (szFolder) = 0) Then
Exit Sub
End If
Set oFolder = oFS.GetFolder (szFolder)
Set oSubFolder = oFolder.SubFolders
For Each f in oSubFolder
call VBS_ClearReadOnlyFlag (f.Path)
Next
Set oFiles = oFolder.Files
For Each f in oFiles
Set f1 = oFS.GetFile (f.Path)
f1.Attributes = f1.Attributes - ReadOnly
Next
End Sub