小程式:FnameReviser
程式名稱: FnameReviser 程式功能: 將一群副檔名不符合的改唯一致化的副檔名,具有副檔名的就改掉副檔名,沒有副檔名的就直接加上副檔名。 參考資料: Micorsoft MSDN2:類別庫參考 system.array system.random system.io.directory system.io.file system.string 程式流程: request User for 指定的目錄 if isExist & isDirectory = false then show error msg and exist program. for each 檔案 in 指定的目錄 origin_name if subname of origin_name != JPG then new_name if new_name is an exist file in the 指定的目錄 then new_name rename from origin_name to new_name in the 指定的目錄 完成程式碼: using System; using System.IO; class FnameReviser { public static string CONST_EXT_NAME = "jpg"; public static string CONST_APPEND_EXTENSION = "." + CONST_EXT_NAME; public static int CONST_RAND_GEN_NAMELEN = 24; public static Random rand = new Random(); public static void Main(String[] args) { string origin_name = null; string new_name = null; string work_dir = null; string[] fileInDir = null; // 要求使用者指定一個資料夾位置 if (args.Length < 1...