Move File - "Illegal characters in path"

  1. Check whether the source file and destination path are exists programmatically before moving the file using methods File.Exists and Directory.Exists respectively .

  2. Use the below methods to check whether the path and file name has any invalid characters and replace as needed.

Path.GetInvalidFileNameChars

Path.GetInvalidPathChars