すべてのファイルとサブフォルダーを再帰的に検索していますが、別のディレクトリに正確なフォルダー構造を作成したいと考えています。
これを手伝っていただければ幸いです。私はこれを自分でやろうとしただけでなく、ウェブを見てみましたが、まだ何も見つけることができませんでした。
そのため、ConvertDir のフォルダー構造を SaveDir の場所に再作成し、ファイルを作成しないようにしたいと考えています。また、これらが見つかると同時に作成されることを望んでいましたが、それが可能かどうか、または賢明かどうかはわかりません。
これにより、SaveDir の最上位にあるフォルダが正しい場所に作成されません。
ここに私のコードのコピーがあります:
On Error Resume Next
Dim ObjFolder
Dim ObjSubFolders
Dim ObjSubFolder
Dim ObjFiles
Dim ObjFile
Dim objFileSecuritySettings
Dim intRetVal
Dim objSD
Dim objFolderSecuritySettings
ObjFolder = FSO.GetFolder(FolderName)
ObjFiles = ObjFolder.Files
For Each ObjFile In ObjFiles 'Write all files to output files
objFileSecuritySettings = _
objWMIService.Get("Win32_LogicalFileSecuritySetting='" & ObjFile.Path & "'")
intRetVal = objFileSecuritySettings.GetSecurityDescriptor(objSD)
If intRetVal = 0 Then
ObjOutFile.WriteLine(ObjFile.Path) ' write in CSV format
End If
Next
ObjSubFolders = ObjFolder.SubFolders 'Getting all subfolders
For Each ObjFolder In ObjSubFolders
objFolderSecuritySettings = _
objWMIService.Get("Win32_LogicalFileSecuritySetting='" & ObjFile.Path & "'")
intRetVal = objFolderSecuritySettings.GetSecurityDescriptor(objSD)
Directory.CreateDirectory(SaveDir + "\\" + ObjFolder.name)
If intRetVal = 0 Then
ObjOutFile.WriteLine(ObjFolder.Path) ' write in CSV format
ObjOutFile.WriteLine(ObjFolder.ObjSubFolders)
End If
Gather(ObjFolder.Path)
Next
前もって感謝します。
アントンSK