I would like to rename files and folders recursively by applying a string replacement operation.
E.g. The word "shark" in files and folders should be replaced by the word "orca".
C:\Program Files\Shark Tools\Wire Shark\Sharky 10\Shark.exe
should be moved to:
C:\Program Files\Orca Tools\Wire Orca\Orcay 10\Orca.exe
The same operation should be of course applied to each child object in each folder level as well.
I was experimenting with some of the members of the System.IO.FileInfo
and System.IO.DirectoryInfo
classes but didn't find an easy way to do it.
fi.MoveTo(fi.FullName.Replace("shark", "orca"));
Doesn't do the trick.
I was hoping there is some kind of "genius" way to perform this kind of operation.