掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
FindFirstでファイルのコピー (ID:42767)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
作成したアプリをいちいちみんなのPCに設定するのが面倒なので、サーバーに置いて、読みに行くソースをメインのEXEファイルに入れたのですが、 DLLとフォルダをコピーしたいんですけど、 ボリュームファイルとかまでついてきているみたいなので、困っています。 できれば、EXEファイルが入っていても排除するソースにしたいのですが。 var osr,nsr:TSearchRec; cnt:Integer; oft,nft:TFileTime; ost,nst:TSystemTime; nd,od:TDateTime; AppPath:String; FromPath,ToPath : String; LCID:Windows.LCID; FileOp:TShFileOpStruct; FileAttrs: Integer; begin AppPath := ExtractFilePath(Application.ExeName); FileAttrs := FaDirectory + FaReadOnly; //DLLのコピー if FindFirst(UpdatePath + '\*.*',FileAttrs,nsr) = 0 then begin Repeat //共有ファイル先のファイルの日付取得 FileTimeToLocalFileTime(nsr.FindData.ftLastWriteTime,nft); FileTimeToSystemTime(nft,nst); nd := SystemTimeToDateTime(nst); //同じファイル名の既存日付取得 FindFirst(AppPath + nsr.Name,FaAnyFile,osr); FileTimeToLocalFileTime(osr.FindData.ftLastWriteTime,oft); FileTimeToSystemTime(oft,ost); od := SystemTimeToDateTime(ost); //確認 ShowMessage(nsr.Name + ' : '+ DateTimeToStr(od) + ' : ' + DateTimeToStr(nd)); //もし新しかったらコピー if od < nd then begin //ファイル原本コピー FromPath := UpDatePath + '\' + nsr.Name + #0#0; ToPath := AppPath + nsr.Name + #0#0; with FileOp do begin Wnd := frmMain.Handle; wFunc := FO_COPY; pFrom := PChar(FromPath); pTo := PChar(ToPath); fFlags := FOF_NOCONFIRMATION;//上書き問い合わせ無し end; SHFileOperation(FileOp); end; until FindNext(nsr) <> 0; FindClose(nsr); FindClose(osr); end; end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.