整个目录copy的新意:SHFileOperation及递归及xcopy (50分)

  • 主题发起人 主题发起人 懒少爷
  • 开始时间 开始时间

懒少爷

Unregistered / Unconfirmed
GUEST, unregistred user!
如何复制整个目录,发觉基本是如题目所述三种,<br>我想问各位的是:<br>能否用SHFileOperation而能copy指定性质的文件?如定某日期的或非隐藏的,等等.<br>
 
Example:<br>uses <br>&nbsp; Windows, SysUtils, ShellAPI, FileCtrl; <br><br>procedure SHCopyFile(hWndOwner: HWND; const SourceFile, TargetFile: string); <br>var Info: TSHFileOpStruct; <br>&nbsp; &nbsp; Aborted : Bool; <br>begin <br>&nbsp; Aborted := False; <br>&nbsp; with Info do <br>&nbsp; begin <br>&nbsp; &nbsp; Wnd := hWndOwner; <br>&nbsp; &nbsp; wFunc := FO_COPY; <br>{ From Microsoft's Help: <br>&nbsp; wFunc = Operation to perform. This member can be one of the following values: <br>&nbsp; FO_COPY Copies the files specified by pFrom to the location specified by pTo. <br>&nbsp; FO_DELETE Deletes the files specified by pFrom (pTo is ignored). <br>&nbsp; FO_MOVE Moves the files specified by pFrom to the location specified by pTo. <br>&nbsp; FO_RENAME Renames the files specified by pFrom. } <br>&nbsp; &nbsp; pFrom := pChar(SourceFile); <br>&nbsp; &nbsp; pTo := pChar(TargetFile); <br>&nbsp; &nbsp; fFlags := 0; <br>&nbsp; &nbsp; fAnyOperationsAborted := Aborted; <br>&nbsp; end; <br>&nbsp; try <br>&nbsp; &nbsp; SHFileOperation(Info); <br>&nbsp; finally <br>&nbsp; &nbsp; if Aborted then; <br>&nbsp; end; <br>end;
 
YB_unique:<br>&nbsp; &nbsp;TSHFileOpStruct里并没有时间日期等属性给定义呀?
 
肯怕不能如你所愿!<br>SHFileOperation函数调用的是一个SHFILEOPSTRUCT结构的参数。而那个结构里根本就没有文件属性的选择!
 
接受答案了.
 
后退
顶部