取得檔案建立日期時間 |
尚未結案
|
personmen
一般會員 發表:7 回覆:12 積分:3 註冊:2003-11-14 發送簡訊給我 |
|
00156
高階會員 發表:45 回覆:195 積分:112 註冊:2002-06-01 發送簡訊給我 |
利用FileAge函數
function FileAge(const FileName: string): Integer;或者利用FindFirst尋找檔案時,傳回的SearchRec裡的Time及FindData屬性可以利用 我曾做過類似功能的程式在: http://mail.apol.com.tw/~frogcoco/myprog/Backup3.zip http://toget.pchome.com.tw/intro/utility_backup/14679.html 或許你可以利用 |
personmen
一般會員 發表:7 回覆:12 積分:3 註冊:2003-11-14 發送簡訊給我 |
|
00156
高階會員 發表:45 回覆:195 積分:112 註冊:2002-06-01 發送簡訊給我 |
引言: 請問FileAge的傳回值代表什麼意思? 如何才能判斷二個檔案中哪個比較新? 因為我想寫在程式碼中, 而不是另外執行其他程式... 謝謝... Person Men有關FileAge傳回值,以下是節錄HELP裡的資料: Description Call FileAge to obtain the OS timestamp of the file specified by FileName. The return value can be converted to a TDateTime object using the FileDateToDateTime function. The return value is -1 if the file does not exist. |
00156
高階會員 發表:45 回覆:195 積分:112 註冊:2002-06-01 發送簡訊給我 |
引言: 如何才能判斷二個檔案中哪個比較新?經過FileDateToDateTime轉換後較大的檔案比較新 例如 var a,b:TDateTime; a:=FileDateToDateTime(FileAge('FILE_A.TXT')); b:=FileDateToDateTime(FileAge('FILE_B.TXT')); if a>b then ShowMessage('FILE_A.TXT 比較新') else if a 如果不經過FileDateToDateTime的轉換,FileAge的傳回值會因作業系統而異,直接比較有可能會有問題:(以下節錄自FileDateToDateTime function/D6 HELP) A timestamp is a signed 32-bit integer, used by the OS to record information such as the date and time a file was modified. The precise format of a timestamp depends on the OS. Use FileDateToDateTime to convert a timestamp to a TDateTime value. |
personmen
一般會員 發表:7 回覆:12 積分:3 註冊:2003-11-14 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |