Справа наверху есть всем известный поисковик с недвусмысленной галочкой ниже - bbs и т.д. И (о чудо!) он таки выдает единственный топик в точности по запросу GSerg'а, где этот вопрос обсужден довольно-таки подробно.GSerg, простите, а вы сами пробовали по таким запросам что то поискать? По точной фразе ничего нет, а по любому слову все что угодно но не по теме вопроса.
var fso = new ActiveXObject("Scriting.FileSystemObject");
var files = new Enumerator (fso.GetFolder("c:\\123").Files);
for (;!files.atEnd();files.moveNext()) {
if (!files.item().Size>0) files.item().Delete();
}
Private Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
Private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
Private Declare Function lstrlen Lib "kernel32" Alias "lstrlenA" (ByVal lpString As String) As Long
Private Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long
Private Const MAX_PATH = 260
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
Private Sub DelNullFiles(ByVal lpPath As String)
Dim hFile As Long
Dim FFD As WIN32_FIND_DATA
Dim FN As String
If Len(lpPath) = 0 Then Exit Sub
If Not (Right$(lpPath, 1) = "\") Then lpPath = lpPath & "\"
hFile = FindFirstFile(lpPath & "*.*", FFD)
If Not (hFile = 0) Then
Do
If Not ((FFD.dwFileAttributes And &H10) = &H10) And (FFD.nFileSizeLow = 0) And (FFD.nFileSizeHigh = 0) Then
FN = FFD.cFileName
FN = Left$(FN, lstrlen(FN))
DeleteFile lpPath & FN
End If
Loop While FindNextFile(hFile, FFD) = 1
FindClose hFile
End If
End Sub
NextFile = Dir(Path, vbNormal)
Do Until NextFile = vbNullString
If FileLen(Path & NextFile) = 0 Then Kill Path & NextFile
NextFile = Dir
DoEvents
Loop
FileSize = FileLen(FilePath)
Сейчас этот форум просматривают: Google-бот и гости: 101