ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] ½Æ»sÀɮצÜÁU½k¸ô®|

¦^´_ 2# GBKEE

G¤j¦n,
§Ú¦b´ú¸Õ®É,¥[¤J¤F§Ú»Ý­nªº¸ô®|,¦ý¤@ª½µLªk°õ¦æ,¥X²{"¤Þ¼Æ¤£¬°¿ï¾Ü©Ê",§ÚµLªk²z¸Ñ¬O¤°»ò¼Ëªº¿ù»~,¥i§_«ü¾É?
¥t¥~§Ú¦b½Æ»s¨ì«ü©w¸ê®Æ§¨«á"W:\0_¦Û­qªí³æ\Backup\­ÜÀx¦@¥Î" & "*" & Format(Date, "YYYYMMDD") & "*\" '¥Øªº¸ê®Æ§¨
·Q¨Ï­ìÀɦW¥[¤W·í¤ë¤ë¥÷,¦ý¦]¬°¨C¤ë¤ë¥÷³£·|ÅÜ°Ê,½Ð°Ý­n«ç»ò¼g,¥¦¤~·|¦b­ìÀÉ«á­±¥[¤W·|Åܰʪº¤ë¥÷?
  1. Option Explicit
  2. Dim sf As Object
  3. Sub ¸s²Õcopy()
  4.     Set sf = CreateObject("Scripting.FileSystemObject")
  5.     ¸s²Õcopy_SubFolder = "W:\Ī¦Ë¦@¥Î\­ÜÀx¦@¥Î\1_²z³f.®w¦s\1.¤é¯Z²z³f´«ºâªí\*5¤ë.xlsx"   '**©I¥sµ{¦¡ °Ñ¼Æ¬° «ü©wªº¸ê®Æ§¨"
  6. End Sub
  7. Sub ¸s²Õcopy_SubFolder(xFolder As String)    '**°Ñ¼Æ¬°¤å¦r
  8.    Dim xSub As Object, E As Variant
  9.     Set xSub = sf.GetFolder(xFolder).SubFolders
  10.     '**SubFolders : ¶Ç¦^¥]§t©Ò¦³¸ê®Æ§¨ªº¤@­Ó Folders ¶°¦Xª«¥ó
  11.     For Each E In xSub
  12.         ¸s²Õcopy_xFiles E     '**©I¥sµ{¦¡ ¶Ç»¼°Ñ¼Æ Folder ª«¥ó
  13.         '**¶Ç»¼¤U¤@¼hªº¸ê®Æ§¨***
  14.         ¸s²Õcopy_SubFolder E.Path       '**©I¥sµ{¦¡ ¶Ç»¼°Ñ¼Æ SubFolders ¶°¦Xª«¥ó
  15.     Next
  16. End Sub
  17. Sub ¸s²Õcopy_xFiles(xF As Variant)       '**°Ñ¼Æ¬°¤å¦r
  18.     Dim E As Variant
  19.     For Each E In xF.Files         '**Files ¶°¦Xª«¥ó : ¸ê®Æ§¨¤ºªº©Ò¦³ File ª«¥óªº¶°¦Xª«¥ó
  20.         Debug.Print E.SHORTPATH = "W:\0_¦Û­qªí³æ\Backup\­ÜÀx¦@¥Î" & "*" & Format(Date, "YYYYMMDD") & "*\" '¥Øªº¸ê®Æ§¨       '** E.SHORTPATH : Àɮתº§¹¾ã¸ô®|¦WºÙ
  21.         '**¦b³o¸Ì®M¤J§A©Ò»Ýªºµ{¦¡½X
  22.         
  23.         '************
  24.     Next
  25. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# PJChen

¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Dim sf As Object
  3. Sub Ex()
  4.     Set sf = CreateObject("Scripting.FileSystemObject")
  5.     Ex_SubFolder "W:\¨p\½d¨Ò\²z³f³æ\"   '**©I¥sµ{¦¡ °Ñ¼Æ¬° «ü©wªº¸ê®Æ§¨"
  6. End Sub
  7. Sub Ex_SubFolder(xFolder As String)    '**°Ñ¼Æ¬°¤å¦r
  8.    Dim xSub As Object, E As Variant
  9.     Set xSub = sf.GetFolder(xFolder).SubFolders
  10.     '**SubFolders : ¶Ç¦^¥]§t©Ò¦³¸ê®Æ§¨ªº¤@­Ó Folders ¶°¦Xª«¥ó
  11.     For Each E In xSub
  12.         Ex_xFiles E     '**©I¥sµ{¦¡ ¶Ç»¼°Ñ¼Æ Folder ª«¥ó
  13.         '**¶Ç»¼¤U¤@¼hªº¸ê®Æ§¨***
  14.         Ex_SubFolder E.Path       '**©I¥sµ{¦¡ ¶Ç»¼°Ñ¼Æ SubFolders ¶°¦Xª«¥ó
  15.     Next
  16. End Sub
  17. Sub Ex_xFiles(xF As Variant)       '**°Ñ¼Æ¬°¤å¦r
  18.     Dim E As Variant
  19.     For Each E In xF.FILES         '**Files ¶°¦Xª«¥ó : ¸ê®Æ§¨¤ºªº©Ò¦³ File ª«¥óªº¶°¦Xª«¥ó
  20.         Debug.Print E.SHORTPATH       '** E.SHORTPATH : Àɮתº§¹¾ã¸ô®|¦WºÙ
  21.         '**¦b³o¸Ì®M¤J§A©Ò»Ýªºµ{¦¡½X
  22.         
  23.         '************
  24.     Next
  25. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

        ÀR«ä¦Û¦b : ¥Í®ð¡A´N¬O®³§O¤Hªº¹L¿ù¨ÓÃg»@¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD