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

[µo°Ý] FileCopy ¦P¦WÀɮפ£Âл\

[µo°Ý] FileCopy ¦P¦WÀɮפ£Âл\

§Ú­n§ì¬Y­Ó¸ê®Æ§¨(A)©³¤U©Ò¦³¸ê®Æ§¨(b¡Bc¡Bd¡B¡B¡B)¸Ì­±ªºexcelÀÉ

¤U¤èµ{¦¡½X¬O¦bGOOGLE·j´M¦Ó±oªº

¦n¹³¬Oª©¤j¦­´Áªº¸Ñ»¡XDD

¦]¬°«Ü¹ê¥Î´N®³¨ÓÀ³¥Î¤F


¦ý¬O§Úµo²{¸I¨ìÀɦW¤@¼ËªºexcelÀÉ

COPY¹L¥h·|Âл\±¼  ³y¦¨Àɮצ³¯Êº|

¯à§_­×§ï§Y¨ÏÀɦW¤@¼Ë  ³£¦s¦b ¦Ó¤£­nªþ»\¹L¥h
  1. 'Option Explicit

  2. Sub SF_collection_Click()

  3.     t = Time
  4.    
  5.     Set fs = CreateObject("Scripting.FileSystemObject")
  6.     Set sf = fs.GetFolder("¸ô®|*****").SubFolders
  7.    
  8.     For Each f In sf
  9.   
  10.         With Application.FileSearch
  11.         .FileType = msoFileTypeExcelWorkbooks
  12.         .LookIn = f
  13.         .Execute
  14.         
  15.         For i = 1 To .FoundFiles.Count
  16.             myfile = Replace(.FoundFiles(i), .LookIn, "")
  17.             FileCopy .FoundFiles(i), "¸ô®|*****" & myfile
  18.         Next
  19.    
  20.         End With
  21.    
  22.     Next
  23.    
  24.     Debug.Print "¸g¹L®É¶¡: " & DateDiff("n", t, Time) & "¤À"
  25.   
  26. End Sub
½Æ»s¥N½X
ÁÂÁÂ~~~
¥Î¥\¨ì¥@¬É¥½¤é¨º¤@¤Ñ¡ã¡ã¡ã

if FileLen( "¸ô®|*****" & myfile ) = 0 then
FileCopy.FoundFiles(i), "¸ô®|*****" & myfile
end if

TOP

¦^´_ 2# bobomi

ÁÂÁÂbobomi¦^ÂÐ

½Ð°Ý³o­Ó¼gªk¬O«ü¦pªGÀɮפ£¦s¦b¤~°õ¦æFileCopyªº°Ê§@¶Ü???
¥Î¥\¨ì¥@¬É¥½¤é¨º¤@¤Ñ¡ã¡ã¡ã

TOP

¦^´_ 1# li_hsien
¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub SF_collection_Click()
  3.     Dim ¥Øªº¥Ø¿ý  As String, ·j´M¥Ø¿ý As String, T As Date, Fs As Object, Sf As Object, f As Object
  4.     Dim i As Integer, ÀɦW As String, °ÆÀɦW As String, ÀɦW_­p¼Æ As Integer, MyDir As String
  5.     ¥Øªº¥Ø¿ý = "D:\"
  6.     ·j´M¥Ø¿ý = "C:\test"
  7.     T = Time
  8.     Set Fs = CreateObject("Scripting.FileSystemObject")
  9.     Set Sf = Fs.GetFolder(·j´M¥Ø¿ý).SubFolders
  10.     For Each f In Sf
  11.         With Application.FileSearch
  12.             .FileType = msoFileTypeExcelWorkbooks
  13.             .LookIn = f             '¶Ç¦^¤j¼gªº¸ê®Æ§¨¦WºÙ
  14.             .Filename = "*.*"
  15.             .Execute
  16.             For i = 1 To .FoundFiles.Count
  17.                 ÀɦW = Fs.GetBaseName(.FoundFiles(i))
  18.                 °ÆÀɦW = Fs.GetExtensionName(.FoundFiles(i))
  19.                 ÀɦW_­p¼Æ = 0
  20.                 MyDir = Dir(¥Øªº¥Ø¿ý & ÀɦW & "*." & °ÆÀɦW, vbDirectory)
  21.                 Do While MyDir <> ""
  22.                     ÀɦW_­p¼Æ = ÀɦW_­p¼Æ + 1
  23.                     MyDir = Dir
  24.                 Loop
  25.                 If ÀɦW_­p¼Æ > 0 Then
  26.                     ÀɦW = ¥Øªº¥Ø¿ý & ÀɦW & "(" & ÀɦW_­p¼Æ & ")." & °ÆÀɦW
  27.                 Else
  28.                     ÀɦW = ¥Øªº¥Ø¿ý & ÀɦW & "." & °ÆÀɦW
  29.                 End If
  30.                 FileCopy .FoundFiles(i), ÀɦW
  31.             Next
  32.         End With
  33.     Next
  34.     Debug.Print "¸g¹L®É¶¡: " & DateDiff("n", T, Time) & "¤À"
  35. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¦^´_  bobomi

ÁÂÁÂbobomi¦^ÂÐ

½Ð°Ý³o­Ó¼gªk¬O«ü¦pªGÀɮפ£¦s¦b¤~°õ¦æFileCopyªº°Ê§@¶Ü???
li_hsien µoªí©ó 2014-9-11 15:58



³o¼Ë´N¥i¥H¤F

On Error Resume Next
If FileLen("¸ô®|*****" & myfile) = 0 Then
On Error GoTo 0
FileCopy.FoundFiles (i), "¸ô®|*****" & myfile
End If

TOP

or

If Dir("¸ô®|*****" & myfile) = "" Then
FileCopy.FoundFiles (i), "¸ô®|*****" & myfile
End If

TOP

¦^´_ 6# bobomi
     
     ÁÂÁÂbobomiªº¦^ÂÐ!!!


     ´ú¸Õ°_¨ÓÀÉ®×ÁÙ¬O¤£¯à¨Ö¦s
   
     §Ú¥Î¤F10­ÓÀÉ®×´ú¸Õ¡A¨ä¤¤¦³2­Ó¦PÀɦW

     ·J¾ã°_¨Ó©Ò­nªºµ²ªGÀ³¸Ó¬O10­Ó³£¦³

     ¦ýµ²ªG¥u¦³9­Ó

  
     §Ú¤£¬O«Ü²M·¡FileLenªº¥Îªk

     ¦ý¬O´N§Ú¥Ø«e²z¸Ñ¡A¬Ýbobomi±zªº¼gªkÀ³¸Ó¬O¦pªGÀɮפ£¦s¦b¤~°õ¦æ§a???


     TKS~
¥Î¥\¨ì¥@¬É¥½¤é¨º¤@¤Ñ¡ã¡ã¡ã

TOP

¨º§A´N¥Î Dir

§Ú²q¨ì§A¥Î FileLen ¬°¦ó¤£¦æ¤F
§Aªº EXCEL ÀɬO csv ¹ï¶Ü
§Ú¤@ª½¤Û·QµÛ¬O§Aªº¬O xls ÀÉ
xls ÀÉ¥ÎFileLen ´N¥i¥H
csv ÀÉ¥ÎFileLen ´N¦³¾÷·|¥X¿ù ( ¨Ò¦p ªÅªº csv ÀÉ)

TOP

¦^´_ 8# bobomi

ÁÂÁÂbobomi¨ó§U

¤£¹L§Úªº½T¹ê¬O.xlsÀÉ

¦Ó¥B§Ú¨â­Ó¤èªk³£¸Õ¹L¤F@@

ÁÙ¬O¤£¯à±N¦P¦WªºÀɮ׫O¯d¤U¨Ó
¥Î¥\¨ì¥@¬É¥½¤é¨º¤@¤Ñ¡ã¡ã¡ã

TOP

¦^´_ 4# GBKEE

ÁÂÁÂGBKEEª©¤j

½T¹ê¥i¦æ!!!

¤Ó¯«¤F!!!

·PÁÂ
¥Î¥\¨ì¥@¬É¥½¤é¨º¤@¤Ñ¡ã¡ã¡ã

TOP

        ÀR«ä¦Û¦b : ª¾ÃÑ­n¥Î¤ßÅé·|¡A¤~¯àÅܦ¨¦Û¤vªº´¼¼z¡C
ªð¦^¦Cªí ¤W¤@¥DÃD