Deprecated code System.IO.File.Move

We have a BPM that renames attachment files to have a timestamp so that people aren’t overwriting other attachments. We can gone through several upgrades without issues with it, but now it’s giving us a warning that it won’t be supported in the future. What should we use instead? (or conversely, is this still needed?)

Jason Woods (jawoods@epicor.com)
12/6/16 */

string oldFileName = "";
string newFileName = "";
foreach (var tt in ds.CustomerAttch.Where(tt => tt.RowMod == "A"))
{
		oldFileName = System.IO.Path.GetFileName(tt.FileName);
		newFileName = System.IO.Path.GetFileNameWithoutExtension(tt.FileName) + "-" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + System.IO.Path.GetExtension(tt.FileName);
		
		System.IO.File.Move(tt.FileName, tt.FileName.Replace(oldFileName, newFileName));
		tt.FileName = tt.FileName.Replace(oldFileName, newFileName);
}```
1 Like

Hello,

See this thread for more context:

1 Like

4 Likes

Because this particular BPM is simply to add a Timestamp to the filename, would this make it so we don’t need that BPM anymore?


If that is the case then we can disable that BPM.

1 Like