線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2180
推到 Plurk!
推到 Facebook!

請問要如何將FINDNEXT找到的檔案複製至指定目錄?

答題得分者是:boss.tw
wishmaster926
初階會員


發表:91
回覆:69
積分:32
註冊:2006-12-13

發送簡訊給我
#1 引用回覆 回覆 發表時間:2009-04-21 11:28:27 IP:61.229.xxx.xxx 訂閱
請問各位高手要如何將FINDNEXT找到的檔案複製至指定目錄???????
我找到的檔名在fileinfo.ff_name里,我有試過API的COPYFILE函數,但
這個函數的目的路徑一定要寫死,也就是說一定要寫成
CopyFile(fileinfo.ffname,"c:\\xxx.txt",false);
但我的檔名是在fileinfo.ffname里,請問這要如何解決?????
請高手們解惑,感恩!!!!!!!!!!!!!!!!!!!!!!!!!
------
~~~~~~~~時時多爬文 勿使惹塵埃~~~~~~~~
~~~~~~~~時時多爬文 勿使惹塵埃~~~~~~~~
~~~~~~~~時時多爬文 勿使惹塵埃~~~~~~~~
編輯記錄
taishyang 重新編輯於 2009-04-21 12:17:25, 註解 刪除標題中大量的問號 -> 企圖以大量的問號吸引注意‧
boss.tw
高階會員


發表:15
回覆:109
積分:194
註冊:2005-05-17

發送簡訊給我
#2 引用回覆 回覆 發表時間:2009-04-21 12:36:10 IP:60.250.xxx.xxx 訂閱

[code cpp]
AnsiString SelectDir = "D:\\Dir\\";
AnsiString DestDir = "C:\\Dir\\SubDir";
AnsiString FileName = "D:\\Dir\\SubDir\\test.txt";
AnsiString OldFileName = FileName;
FileName.Delete( 1, strlen(SelectDir.c_str() ) );
CopyFile( OldFileName.c_str(), AnsiString( DestDir "\\" ExtractFileName( FileName ) ).c_str() , false );
[/code]

===================引 用 wishmaster926 文 章===================
請問各位高手要如何將FINDNEXT找到的檔案複製至指定目錄???????
我找到的檔名在fileinfo.ff_name裡,我有試過API的COPYFILE函數,但
這個函數的目的路徑一定要寫死,也就是說一定要寫成
CopyFile(fileinfo.ffname,"c:\\xxx.txt",false);
但我的檔名是在fileinfo.ffname裡,請問這要如何解決?????
請高手們解惑,感恩!!!!!!!!!!!!!!!!!!!!!!!!!
編輯記錄
boss.tw 重新編輯於 2009-04-21 12:39:30, 註解 無‧
wishmaster926
初階會員


發表:91
回覆:69
積分:32
註冊:2006-12-13

發送簡訊給我
#3 引用回覆 回覆 發表時間:2009-04-21 19:32:39 IP:61.229.xxx.xxx 訂閱

===================引 用 boss.tw 文 章===================

[code cpp]
AnsiString SelectDir = "D:\\Dir\\";
AnsiString DestDir = "C:\\Dir\\SubDir";
AnsiString FileName = "D:\\Dir\\SubDir\\test.txt";
AnsiString OldFileName = FileName;
FileName.Delete( 1, strlen(SelectDir.c_str() ) );
CopyFile( OldFileName.c_str(), AnsiString( DestDir "\\" ExtractFileName( FileName ) ).c_str() , false );
[/code]

===================引 用 wishmaster926 文 章===================
請問各位高手要如何將FINDNEXT找到的檔案複製至指定目錄???????
我找到的檔名在fileinfo.ff_name裡,我有試過API的COPYFILE函數,但
這個函數的目的路徑一定要寫死,也就是說一定要寫成
CopyFile(fileinfo.ffname,"c:\\xxx.txt",false);
但我的檔名是在fileinfo.ffname裡,請問這要如何解決?????
請高手們解惑,感恩!!!!!!!!!!!!!!!!!!!!!!!!!

感謝大哥,我試過,已ok了.感恩
另外還有一問題,就是findfirst("*.*",&fileinfo,FA_DIREC|FA_ARCH)
他是不是只能找dos 8-3格式的檔名,那如果我現在如果要搜尋 .docx 附檔名的檔案,
findfirst是不是就無法搜尋??????
------
~~~~~~~~時時多爬文 勿使惹塵埃~~~~~~~~
~~~~~~~~時時多爬文 勿使惹塵埃~~~~~~~~
~~~~~~~~時時多爬文 勿使惹塵埃~~~~~~~~
boss.tw
高階會員


發表:15
回覆:109
積分:194
註冊:2005-05-17

發送簡訊給我
#4 引用回覆 回覆 發表時間:2009-04-21 21:01:49 IP:122.116.xxx.xxx 訂閱

extern PACKAGE int __fastcall FindFirst(const AnsiString Path, int Attr, TSearchRec &F);

Description

FindFirst searches the directory specified by Path for the first file that matches the file name implied by Path and the attributes specified by the Attr parameter. The result is returned in the F parameter. Use the fields of this search record to extract the information needed. FindFirst returns 0 if a file was successfully located, otherwise, it returns an error code.

The Path constant parameter is the directory and file name mask, including wildcard characters. For example, 屬:\test\*.*?specifies all files in the C:\TEST directory).

The Attr parameter specifies the special files to include in addition to all normal files. Choose from these file attribute constants when specifying the Attr parameter:

Constant Value Description

faReadOnly $00000001 Read-only files
faHidden $00000002 Hidden files
faSysFile $00000004 System files
faVolumeID $00000008 Volume ID files
faDirectory $00000010 Directory files
faArchive $00000020 Archive files
faAnyFile $0000003F Any file
編輯記錄
boss.tw 重新編輯於 2009-04-21 21:02:56, 註解 無‧
boss.tw 重新編輯於 2009-04-21 21:04:03, 註解 無‧
系統時間:2024-04-30 9:36:58
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!