c# - How to rename a fileInfo by adding \\?\ prefix to avoid System.IO.PathTooLongException? -


i'm looking way avoid system.io.pathtoolongexception. read put \\?\ in front of long path.

the problem have fileinfo objects , ask me how add \\?\ path prefix fileinfo paths without writting useless code.

note have folders several thousand of files copy , don't want application takes lot of useless time during process.

thanks.

directoryinfo dir = new directoryinfo(sourcedirname); fileinfo[] files = dir.getfiles(constants.all_files, searchoption.alldirectories);  foreach (fileinfo file in files) {     file.copyto(destabsolutepath); } 


Comments