MFC dfs遍歷檔案

2022-04-29 18:33:09 字數 854 閱讀 6999

//如果涉及到大檔案的遍歷(大於4gb),可以將以下**_finddata_t換成__finddata64_t,_findfirst換成_findfirst64,_findnext換成_findnext64

void dfsfolder(cstring dirpath)do}

}else 

else if (fileinfo.size/(1024.0*1024.0)<1)

//最後修改檔案的時間

ctime time(fileinfo.time_write);

cstring timestr = time.format( "%y/%m/%d %h:%m:%s" );

// 檔案名字(包括字尾名)

cstring nameext(fileinfo.name);

int i=nameext.reversefind('.');

cstring name=nameext.left(i);

cstring ext=nameext.mid(i+1);

}}while (_findnext(handle, &fileinfo) == 0);

_findclose(handle);

}//以下**可以複製帶有子資料夾的資料夾

void dfscopyfolder(cstring srcpath, cstring dstpath)do}

//遞迴遍歷更深層次的資料夾

dfscopyfolder(newsrcpath, newdstpath);}}

}else 

}}while (_findnext(handle, &fileinfo) == 0);

_findclose(handle);

}

vb 遍歷資料夾 與遍歷檔案

public sub search wenjian 遍歷檔案 獲得檔名稱 dim spath as string 查詢檔案夾 spath dir path,vbdirectory 查詢第乙個資料夾 do while len spath 迴圈到沒有資料夾為止 if left spath,1 then ...

perl遍歷檔案

本貼對三種遍歷資料夾方法比較。1.使用file find 2.遞迴遍歷。遍歷函式為lsr 3.使用佇列或棧遍歷。遍歷函式為lsr s 1.use file find copy to clipboard code usr bin perl w file find.pl author 路小佳 licen...

遞迴遍歷檔案

function enumfileinrecursion path pchar longint stdcall varsearchrec tsearchrec found integer tmpstr string i integer begin i 1 result 0 查詢結果 檔案數 加上搜尋...