Linux下 C++遍歷目錄下所有文件
1 rename(image_path.c_str(), image_path_new.c_str()); 2 remove(image_path_move.c_str());
上述批量操作的代碼是在linux下的參數設置:
rename的參數,image_path為原文件的路徑+文件名,image_path_new為文件重命名的路徑+文件名。兩者在windows下均為string類型即可,但是在linux下需要轉換成char型。
remove的參數,image_path_move同樣為刪除文件的路徑+文件名,不同系統下的參數格式也不同。
?