26 Aralık 2011 Pazartesi

Deleting Files in a Specific Size Script

Belirli bir boyuttan küçük dosyaları silme Script


---------

On Error Resume Next
Function ShowFileList

Klasor = "c:\test_folder\" 'klasor yolu
Limit  = 1000000  'silinecek max dosya limiti kb
Uzanti = "log" 'silenecek dosya uzantisi


Dim fso, f, f1, fc
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(Klasor)
Set fc = f.Files
For Each f1 in fc
yol=Klasor&f1.name 
Set Dosya = fso.GetFile(yol)
D_Uzanti = right(f1.name,len(f1.name)-instrrev(f1.name,"."))
if Dosya.Size > limit  and (ucase(D_Uzanti) = Uzanti or lcase(D_Uzanti) = Uzanti) then
Set Dosya_sil = fso.GetFile(yol)
Dosya_sil.Delete 
end if
Next
ShowFileList = s
End Function
ShowFileList
--------

Hiç yorum yok:

Yorum Gönder