Move (cut) file (specify path)

From , 3 Years ago, written in C#, viewed 220 times.
URL https://pastebin.vip/view/f7ac67a9
  1. /// <summary>
  2. /// 指定路径移动(剪切)文件
  3. /// 注意:文件的移动要求原路径文件必须存在,新路径文件必须不存在
  4. /// </summary>
  5. /// <param name="oldPath">原路径</param>
  6. /// <param name="newPath">新路径</param>
  7. public void moveMyFile ( string oldPath, string newPath )
  8. {
  9.         if ( File.Exists ( oldPath ) && !File.Exists ( newPath ) )
  10.         {
  11.                 File.Move ( oldPath, newPath );
  12.                 MessageBox.Show ( "移动(剪切)成功!" );
  13.         }
  14.         else
  15.         {
  16.                 MessageBox.Show ( "原路径文件不存在或新路径文件已存在!" );
  17.         }
  18. }
  19.  

Reply to "Move (cut) file (specify path)"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website