C 資料夾拷貝

2021-05-31 22:27:46 字數 1164 閱讀 5717

using system;

using system.collections.generic;

using system.text;

using system.collections;

using system.io;

using system.windows.forms;

namespace gwmultmediacheck

//獲取所有檔名

private arraylist getfilename(string dirpath)

return list;

}//獲取所有資料夾及子資料夾

private void getdirs(string dirpath)}}

///

/// 獲取給出資料夾及其子資料夾下的所有檔名

/// (檔名為路徑加檔名及字尾,

/// 使用的時候getallfilename().toarray()方法可以轉換成object陣列

/// 之後再tostring()分別得到檔名)

///

/// 資料夾根目錄

///

public arraylist getallfilename(string rootpath)

return list;

}//拷貝資料夾下的所有檔案和資料夾

public string  copydirectory(string sourcedirname, string destdirname)

if (destdirname[destdirname.length - 1] != path.directoryseparatorchar)

destdirname = destdirname + path.directoryseparatorchar;

string files = directory.getfiles(sourcedirname);

foreach (string file in files)

string dirs = directory.getdirectories(sourcedirname);

foreach (string dir in dirs)

}catch (exception ex)

return strlog;

}  }

}

C 拷貝資料夾

拷貝資料夾中的所有內容至另外乙個該資料夾 原資料夾路徑名 目標資料夾路徑名 private static void copydirectory string srcdir,string desdir if directory.exists desdir 拷貝當前資料夾下所有檔案 try拷貝至 f,d...

拷貝資料夾

需要引用命名空間 using system.io 拷貝資料夾 包括子資料夾 到指定資料夾下,源資料夾和目標資料夾均需絕對路徑.格式 copyfolder 源資料夾,目標資料夾 public static void copyfolder string strfrompath,string strtop...

拷貝資料夾

需要引用命名空間 using system.io 拷貝資料夾 包括子資料夾 到指定資料夾下,源資料夾和目標資料夾均需絕對路徑.格式 copyfolder 源資料夾,目標資料夾 public static void copyfolder string strfrompath,string strtop...