xavier880819
发表于 2009-7-21 08:55:17
感谢分享您的经验啊,如果不是你们的帮助,我还真不知道怎么做,这样看了以后一下子就明朗了许多。
再次感谢!!
jiaxinfu
发表于 2009-7-21 17:06:24
呵呵。。。。八楼很不错,学习了
menfan
发表于 2009-7-21 18:28:00
学习一下。。
xavier880819
发表于 2009-7-22 13:31:02
请教 afan,
我现在在尝试复制文件进创建了的文件夹, 那么用DirCopy,能不能够做到将文件复制进每一个文件夹呢?我尝试好像只能复制进某一个文件夹,而不能做到全部。
afan
发表于 2009-7-22 13:35:22
19# xavier880819
每个文件夹都复制同一个文件吗?
feicuiboy
发表于 2009-7-22 13:35:57
本帖最后由 feicuiboy 于 2009-7-22 13:37 编辑
俺的挂载网页的,谁帮我实现实现啊?
http://www.autoitx.com/forum.php?mod=viewthread&tid=8283
xavier880819
发表于 2009-7-22 14:29:04
20# afan
对,其实不只是一个文件,可能是几个文件这样,每个文件夹都复制同样的文件。
谢谢
afan
发表于 2009-7-22 14:50:59
哦,应该不难吧,我再试试
xavier880819
发表于 2009-7-22 14:53:15
23# afan
谢谢你,我目前还是只能导入到一个文件夹
afan
发表于 2009-7-22 15:10:52
我现在可以做到每个文件夹都复制源文件夹里的所有文件,不过这样会不会感觉很乱?因为文件夹里不仅有文件,还有二级文件夹……
afan
发表于 2009-7-22 15:14:37
本帖最后由 afan 于 2009-7-22 15:37 编辑
是不是只在最底层文件夹里复制呢,那样好像比较合理点
xavier880819
发表于 2009-7-22 15:40:12
26# afan
不是最底层,就是每一层都要复制,原来你可以做到啊??我真想看看怎么做呢?
xavier880819
发表于 2009-7-22 15:41:20
就是每一层的每个文件夹全都复制
afan
发表于 2009-7-22 16:10:35
你试试吧~
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#NoTrayIcon
$Form1 = GUICreate('多层文件夹生成工具', 385, 150)
Dim $n = 1, $l, $s
For $n = 1 To 10
$l[$n] = GUICtrlCreateLabel("第" & $n & "层", 12 + 74 * ($n - (Int(($n - 1) / 5)) * 5 - 1), 23 + 20 * (Int(($n - 1) / 5)), 37, 16)
$s[$n] = GUICtrlCreateInput("0", 46 + 74 * ($n - (Int(($n - 1) / 5)) * 5 - 1), 20 + 20 * (Int(($n - 1) / 5)), 30, 16, $ES_NUMBER)
GUICtrlSetLimit(-1, 4)
Next
$yml = GUICtrlCreateInput("", 10, 70, 295, 20)
$Button2 = GUICtrlCreateButton("源文件夹", 306, 69, 70, 22)
$Button = GUICtrlCreateButton("生成文件夹(&G)", 80, 95, 190, 25)
$xs = GUICtrlCreateLabel("0/0", 290, 108, 80, 15)
GUICtrlSetColor(-1, 0x0000FF)
$jdt = GUICtrlCreateProgress(10, 125, 365, 12)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
exit
Case $Button
GUICtrlSetData($jdt, 0)
GUICtrlSetState($Button, $GUI_DISABLE)
Dim $ywc = 0, $zs = 0, $sc = 1
jc()
AdlibEnable("jdt")
If GUICtrlRead($s) = 0 then
msgbox(48, '问题', '未设置文件夹数量? 请返回设置。 ')
Else
scml()
sleep(250)
AdlibDisable()
msgbox(64, '完成', '创建 ' & $zs & ' 个文件夹完成! ')
endif
GUICtrlSetState($Button, $GUI_ENABLE)
Case $Button2
$ywjj = FileSelectFolder("选择文件夹", "", 4)
If @error Then ContinueLoop
GUICtrlSetData($yml, $ywjj)
EndSwitch
WEnd
Func jc()
For $i = 10 To 1 Step -1
$sl = GUICtrlRead($s[$i])
If $sl > 0 then
For $i1 = 1 To $i
$sl1 = GUICtrlRead($s[$i1])
If $sl1 = 0 then
GUICtrlSetData($s[$i1], 1)
$sl1 = 1
endif
$zs = $zs + ($sc * $sl1)
$sc = $sc * $sl1
Next
ExitLoop
Endif
Next
EndFunc ;==>jc
Func scml()
$ymlr = GUICtrlRead($yml)
$sl1 = GUICtrlRead($s)
For $i1 = 1 To $sl1
$fn1 = 'F'
$xml1 = $fn1 & $i1
DirCreate($xml1)
if $ymlr <> '' then DirCopy($ymlr, $xml1, 1)
$ywc = $ywc + 1
$sl2 = GUICtrlRead($s)
For $i2 = 1 To $sl2
$fn2 = $fn1 & $i1
$xml2 = $fn2 & '\' & $fn2 & '-' & $i2
DirCreate($xml2)
if $ymlr <> '' then DirCopy($ymlr, $xml2, 1)
$ywc = $ywc + 1
$sl3 = GUICtrlRead($s)
For $i3 = 1 To $sl3
$fn3 = $fn2 & '-' & $i2
$xml3 = $fn2 & '\' & $fn3 & '\' & $fn3 & '-' & $i3
DirCreate($xml3)
if $ymlr <> '' then DirCopy($ymlr, $xml3, 1)
$ywc = $ywc + 1
$sl4 = GUICtrlRead($s)
For $i4 = 1 To $sl4
$fn4 = $fn3 & '-' & $i3
$xml4 = $fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn4 & '-' & $i4
DirCreate($xml4)
if $ymlr <> '' then DirCopy($ymlr, $xml4, 1)
$ywc = $ywc + 1
$sl5 = GUICtrlRead($s)
For $i5 = 1 To $sl5
$fn5 = $fn4 & '-' & $i4
$xml5 = $fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn5 & '\' & $fn5 & '-' & $i5
DirCreate($xml5)
if $ymlr <> '' then DirCopy($ymlr, $xml5, 1)
$ywc = $ywc + 1
$sl6 = GUICtrlRead($s)
For $i6 = 1 To $sl6
$fn6 = $fn5 & '-' & $i5
$xml6 = $fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn5 & '\' & $fn6 & '\' & $fn6 & '-' & $i6
DirCreate($xml6)
if $ymlr <> '' then DirCopy($ymlr, $xml6, 1)
$ywc = $ywc + 1
$sl7 = GUICtrlRead($s)
For $i7 = 1 To $sl7
$fn7 = $fn6 & '-' & $i6
$xml7 = $fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn5 & '\' & $fn6 & '\' & $fn7 & '\' & $fn7 & '-' & $i7
DirCreate($xml7)
if $ymlr <> '' then DirCopy($ymlr, $xml7, 1)
$ywc = $ywc + 1
$sl8 = GUICtrlRead($s)
For $i8 = 1 To $sl8
$fn8 = $fn7 & '-' & $i7
$xml8 = $fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn5 & '\' & $fn6 & '\' & $fn7 & '\' & $fn8 & '\' & $fn8 & '-' & $i8
DirCreate($xml8)
if $ymlr <> '' then DirCopy($ymlr, $xml8, 1)
$ywc = $ywc + 1
$sl9 = GUICtrlRead($s)
For $i9 = 1 To $sl9
$fn9 = $fn8 & '-' & $i8
$xml9 = $fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn5 & '\' & $fn6 & '\' & $fn7 & '\' & $fn8 & '\' & $fn9 & '\' & $fn9 & '-' & $i9
DirCreate($xml9)
if $ymlr <> '' then DirCopy($ymlr, $xml9, 1)
$ywc = $ywc + 1
$sl10 = GUICtrlRead($s)
For $i10 = 1 To $sl10
$fn10 = $fn9 & '-' & $i9
$xml10 = $fn2 & '\' & $fn3 & '\' & $fn4 & '\' & $fn5 & '\' & $fn6 & '\' & $fn7 & '\' & $fn8 & '\' & $fn9 & '\' & $fn10 & '\' & $fn10 & '-' & $i10
DirCreate($xml10)
if $ymlr <> '' then DirCopy($ymlr, $xml10, 1)
$ywc = $ywc + 1
Next
Next
Next
Next
Next
Next
Next
Next
Next
Next
Endfunc ;==>scml
Func jdt()
GUICtrlSetData($jdt, $ywc / $zs * 100)
GUICtrlSetData($xs, $ywc & '/' & $zs)
EndFunc ;==>jdt
afan
发表于 2009-7-22 16:12:50
如果只需要在所有最底层文件夹复制也可以做到,再加一些判断就可以了