Set FSys = CreateObject("Scripting.FileSystemObject") kol=0 Do fnd=InStr(Path,";") If fnd=0 Then CurFolder=Path Else CurFolder=Mid(Path,1,fnd-1) Path=Mid(Path,fnd+1) End If ScanFolder(CurFolder) MsgBox kol&" файлов в "&CurFolder&" переименовано" Loop Until fnd=0
Sub ScanFolder(folderSpec) Set thisFolder = FSys.GetFolder(folderSpec) Set thisFiles=thisFolder.Files If thisFiles.Count>0 Then For Each file in thisFiles RenOneFile(file) Next End If Set thisSubFolders = thisFolder.SubFolders For Each folder in thisSubFolders ScanFolder(folder.path) Next End Sub
Sub RenOneFile(fileSpec) s="" otv=false For i=1 To Len(fileSpec) smb=Mid(fileSpec,i,1) Select Case smb Case "і" smb="i": otv=true Case "І" smb="I": otv=true End Select s=s+smb Next If otv=true Then If FSys.FileExists(s)=false Then kol=kol+1 FSys.MoveFile fileSpec,s End If End If End Sub