Advertisement
2002ASP Files/ File Controls/ Input/ Output #2141

Copy files in directory - Extremely simple!!

With this code you can copy all files within a directory with a particular extension to another directory. Actually it will give you a progressive listing of a file with a wildcard and then you can do whatever you want with the file. Extremely simple and straightforward. I dont understand why the other codes are so huge. If you find an error or if you would like to comment please leave a messge.

AI

Riepilogo AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Codice sorgente
original-source
Private Sub Command1_Click()
 Dim fName As String
 fName = Dir("c:\tempo\*.doc") ' Retrieve the first entry.
 Do While fName <> "" ' Start the loop.
 If GetAttr("c:\tempo\" & fName) <> vbDirectory Then 'only files
  FileCopy "c:\tempo\" & fname, "c:\tempx\" & fName 'copies the file
  'Kill "c:\tempo\" & fname 'deletes the original - optional
 End If 
 fName = Dir ' Get next entry.
 Loop
End Sub
Commenti originali (3)
Recuperato da Wayback Machine