public void ProcessFile(string path) { var newFileName = FileAndDirectoryHelper.GetTrimmedFileNameFromPath(path); var newLocation = GenerateNewLocation(path, newFileName); new System.IO.FileInfo(newLocation).Directory.Create(); // Create the new folder if it doesn't exist File.Move(path, newLocation); Console.WriteLine("Processed file '{0}'.", path); }
private string GenerateNewLocation(string oldPath, string newFileName) { var appId = FileAndDirectoryHelper.GetFileNamePrefixFromPath(oldPath, '_'); var newFolder = GetGameNameFromAppId(int.Parse(appId)); var newPath = oldPath.Substring(0, oldPath.LastIndexOf('\\')); newPath += "\\" + newFolder; newPath += "\\" + newFileName; return(newPath); }