0
다른 디렉터리로 디렉터리를 복사하는 데 사용되는 파일 복사 프로그램을 수정하려고합니다. 이제 복사본을 실행하기 위해 목록에있는 디렉터리와 파일을 모두 전달하려고합니다.FileSystemInfo에 FileInfo 캐스팅
For Each _fromPath In CopyList
Dim FSinfo As FileSystemInfo()
If Directory.Exists(_fromPath) Then
Dim dir As New DirectoryInfo(_fromPath)
FSinfo = dir.GetFileSystemInfos
ElseIf File.Exists(_fromPath) Then
Dim file As New FileInfo(_fromPath)
FSinfo = file
End If
CountFiles(FSinfo)
Next
Private Function CountFiles(ByVal FSInfo As FileSystemInfo()) As Boolean
이 코드는 디렉토리에서 잘 작동합니다. CountFiles에 패스를 전달하려면 FileSystemInfo에 있어야합니다. FileInfo를 FileSystemInfo로 형변환 (cast)하는 방법이 있습니까?
나는CType(file, FileSystemInfo)
을 시도하지만
Value of type 'System.IO.FileInfo' cannot be converted to '1-dimensional array of System.IO.FileSystemInfo'.