網絡指定位置和本地指定位置對比,怎樣del本地僅有的文件和目錄 |
尚未結案
|
skc
一般會員 發表:13 回覆:9 積分:4 註冊:2005-05-17 發送簡訊給我 |
|
pcboy
版主 發表:177 回覆:1838 積分:1463 註冊:2004-01-13 發送簡訊給我 |
標準作法是
從 c:\dataa 取一個檔案, 看在\\server\dataa 中是否存在, 在則保留, 不在砍掉, 然後再取下一個檔案, 重複相同動作 如果 b,c,d 不大 , 將 c:\dataa 全部砍掉, 再將 b, c, d 拷貝過去比較快 *********************
如果您滿意答案,請結案
*********************
------
能力不足,求助於人;有能力時,幫幫別人;如果您滿意答覆,請適時結案! 子曰:問有三種,不懂則問,雖懂有疑則問,雖懂而想知更多則問! |
skc
一般會員 發表:13 回覆:9 積分:4 註冊:2005-05-17 發送簡訊給我 |
|
ko
資深會員 發表:28 回覆:785 積分:444 註冊:2002-08-14 發送簡訊給我 |
skc 你好:
其實搜尋一下本站就有你想要的東西-- Function File_DirOperations_Datail(
Action : String; {COPY, DELETE, MOVE, RENAME}
RenameOnCollision : Boolean; {Renames if directory exists}
NoConfirmation : Boolean; {Responds "Yes to All" to any dialogs}
Silent : Boolean; {No progress dialog is shown}
ShowProgress : Boolean; {displays progress dialog but no file names}
FromDir : String; {From directory}
ToDir : String {To directory}
): Boolean;
var
SHFileOpStruct : TSHFileOpStruct;
FromBuf, ToBuf: Array [0..255] of Char;
begin
Try
If Not DirectoryExists(FromDir) Then
Begin
Result := False;
Exit;
End;
Fillchar(SHFileOpStruct, Sizeof(SHFileOpStruct), 0 );
FillChar(FromBuf, Sizeof(FromBuf), 0 );
FillChar(ToBuf, Sizeof(ToBuf), 0 );
StrPCopy(FromBuf, FromDir);
StrPCopy(ToBuf, ToDir);
With SHFileOpStruct Do
Begin
Wnd := 0;
If UpperCase(Action) = 'COPY' Then wFunc := FO_COPY;
If UpperCase(Action) = 'DELETE' Then wFunc := FO_DELETE;
If UpperCase(Action) = 'MOVE' Then wFunc := FO_MOVE;
If UpperCase(Action) = 'RENAME' Then wFunc := FO_RENAME;
pFrom := @FromBuf;
pTo := @ToBuf;
//fFlags := FOF_ALLOWUNDO; // 有加這一行, 就會將刪的目錄丟進資源回收桶
If RenameOnCollision Then fFlags := fFlags or FOF_RENAMEONCOLLISION;
If NoConfirmation Then fFlags := fFlags or FOF_NOCONFIRMATION;
If Silent Then fFlags := fFlags or FOF_SILENT;
If ShowProgress Then fFlags := fFlags or FOF_SIMPLEPROGRESS;
End;
Result := (SHFileOperation(SHFileOpStruct) = 0);
Except
Result := False;
End;
end; 用法:
File_DirOperations_Datail('DELETE', False, True, True, True, 'C:\Temp', '');
------
====================== 昏睡~ 不昏睡~ 不由昏睡~ |
skc
一般會員 發表:13 回覆:9 積分:4 註冊:2005-05-17 發送簡訊給我 |
TSHFileOpStruct
是用什麼類型的呢........ [Error] Unit1.pas(111): Undeclared identifier: 'TSHFileOpStruct'
[Error] Unit1.pas(127): Undeclared identifier: 'Wnd'
[Error] Unit1.pas(128): Undeclared identifier: 'wFunc'
[Error] Unit1.pas(129): Undeclared identifier: 'FO_DELETE'
[Error] Unit1.pas(130): Undeclared identifier: 'FO_MOVE'
[Error] Unit1.pas(131): Undeclared identifier: 'FO_RENAME'
[Error] Unit1.pas(132): Undeclared identifier: 'pFrom'
[Error] Unit1.pas(133): Undeclared identifier: 'pTo'
[Error] Unit1.pas(135): Undeclared identifier: 'fFlags'
[Error] Unit1.pas(135): Undeclared identifier: 'FOF_RENAMEONCOLLISION'
[Warning] Unit1.pas(135): Combining signed and unsigned types - widened both operands
[Error] Unit1.pas(136): Undeclared identifier: 'FOF_NOCONFIRMATION'
[Warning] Unit1.pas(136): Combining signed and unsigned types - widened both operands
[Error] Unit1.pas(137): Undeclared identifier: 'FOF_SILENT'
[Error] Unit1.pas(138): Undeclared identifier: 'FOF_SIMPLEPROGRESS'
[Warning] Unit1.pas(138): Combining signed and unsigned types - widened both operands
[Error] Unit1.pas(140): Undeclared identifier: 'SHFileOperation'
|
ko
資深會員 發表:28 回覆:785 積分:444 註冊:2002-08-14 發送簡訊給我 |
|
skc
一般會員 發表:13 回覆:9 積分:4 註冊:2005-05-17 發送簡訊給我 |
|
Ktop_Robot
站務副站長 發表:0 回覆:3511 積分:0 註冊:2007-04-17 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |