I'm trying to write some code to rename all the files in the directory and subdirectories. If the file has no extension it needs to add the extension .txt.Code:Dim Files As String() = IO.Directory.GetFiles(f.SelectedPath + "\", "*.*", IO.SearchOption.AllDirectories) Dim fil As String For Each fil In Files If fil.IndexOf(".") = -1 Then FileSystem.Rename(fil, fil & ".txt") End If Next
Any help appreciated.




Reply With Quote