#include <File.au3>
$sRootPath = FileSelectFolder('xxxx', '')
copy($sRootPath)
Func copy($sPath)
;处理文件
$aFileList = _FileListToArray($sPath, '*', 1)
If Not @error Then
$sSubPath = StringReplace($sPath, $sRootPath, '');先去掉根目录,取得子目录名
If StringLeft($sSubPath, 1) = '\' Then $sSubPath = StringTrimLeft($sSubPath, 1) & '\';字符处理
For $i = 1 To $aFileList[0];复制
FileCopy($sPath & '\' & $aFileList[$i], @DesktopDir & '\' & StringReplace($sSubPath, '\', '_') & $aFileList[$i])
Next
EndIf
;处理文件夹
$aFolderList = _FileListToArray($sPath, '*', 2)
If Not @error Then
For $i = 1 To $aFolderList[0]
copy($sPath & '\' & $aFolderList[$i]);继续递归子目录
Next
EndIf
EndFunc ;==>copy
|