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

網絡指定位置和本地指定位置對比,怎樣del本地僅有的文件和目錄

尚未結案
skc
一般會員


發表:13
回覆:9
積分:4
註冊:2005-05-17

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-05-20 01:36:20 IP:202.175.xxx.xxx 未訂閱
例如: \\server\dataa b c d c:\dataa b c d e f g set 問題是怎樣del e,f,g和set這個子目錄!
pcboy
版主


發表:177
回覆:1838
積分:1463
註冊:2004-01-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-05-20 09:37:37 IP:210.69.xxx.xxx 未訂閱
標準作法是 從 c:\dataa 取一個檔案, 看在\\server\dataa 中是否存在, 在則保留, 不在砍掉, 然後再取下一個檔案, 重複相同動作 如果 b,c,d 不大 , 將 c:\dataa 全部砍掉, 再將 b, c, d 拷貝過去比較快 ********************* 如果您滿意答案,請結案 *********************
------
能力不足,求助於人;有能力時,幫幫別人;如果您滿意答覆,請適時結案!

子曰:問有三種,不懂則問,雖懂有疑則問,雖懂而想知更多則問!
skc
一般會員


發表:13
回覆:9
積分:4
註冊:2005-05-17

發送簡訊給我
#3 引用回覆 回覆 發表時間:2005-05-20 09:49:32 IP:202.175.xxx.xxx 未訂閱
怎樣做呢.... 不可以具體一點嗎? 可不可以\\server\game\*.*和c:\game\*.*對比呀 然後把只存在在本地的刪除呢?
ko
資深會員


發表:28
回覆:785
積分:444
註冊:2002-08-14

發送簡訊給我
#4 引用回覆 回覆 發表時間:2005-05-20 09:59:58 IP:220.132.xxx.xxx 未訂閱
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

發送簡訊給我
#5 引用回覆 回覆 發表時間:2005-05-21 02:22:44 IP:202.175.xxx.xxx 未訂閱
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

發送簡訊給我
#6 引用回覆 回覆 發表時間:2005-05-21 12:58:01 IP:220.132.xxx.xxx 未訂閱
skc 你好: 要 uses shellapi;
------
======================
昏睡~
不昏睡~
不由昏睡~
skc
一般會員


發表:13
回覆:9
積分:4
註冊:2005-05-17

發送簡訊給我
#7 引用回覆 回覆 發表時間:2005-05-21 20:01:15 IP:202.175.xxx.xxx 未訂閱
解決了... 但是發現 他是整個目錄del的....不是只del本地目錄僅存在的文件!!!
Ktop_Robot
站務副站長


發表:0
回覆:3511
積分:0
註冊:2007-04-17

發送簡訊給我
#8 引用回覆 回覆 發表時間:2007-04-26 13:50:46 IP:000.000.xxx.xxx 未訂閱
提問者您好:


以上回應是否已得到滿意的答覆?


若已得到滿意的答覆,請在一週內結案,否則請在一週內回覆還有什麼未盡事宜,不然,
將由版主(尚無版主之區域將由副站長或站長)自由心證,選擇較合適之解答予以結案處理,
被選上之答題者同樣會有加分獎勵同時發問者將受到扣 1 分的處分。不便之處,請見諒。


有問有答有結案,才能有良性的互動,良好的討論環境需要大家共同維護,感謝您的配合。

------
我是機器人,我不接受簡訊.
系統時間:2024-05-15 6:33:28
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!