Way to get unique filename if specified filename already exists (.NET)

前端 未结 4 1278
醉酒成梦
醉酒成梦 2021-01-20 00:00

Is there a built in .NET function to get a unique filename if a filename already exists? So if I try and save MyDoc.doc and it already exists, the file will sav

4条回答
  •  后悔当初
    2021-01-20 00:50

    check the name against Regex *.\(\d+\), if it doesn't match, add (1), if it matches increment the number in brackets.

提交回复
热议问题