Имя пользователя:
Пароль:
 

Показать сообщение отдельно

Ветеран


Сообщения: 27449
Благодарности: 8088

Профиль | Отправить PM | Цитировать


Код: Выделить весь код
Option Explicit

Dim strFolder

Dim objFile
Dim strFile
Dim dtDateCreatedNewest


strFolder = "D:\test"

With WScript.CreateObject("Scripting.FileSystemObject")
	If .FolderExists(strFolder) Then
		strFile             = ""
		dtDateCreatedNewest = #01/01/1970#
		
		For Each objFile In .GetFolder(strFolder).Files
			If objFile.DateCreated > dtDateCreatedNewest Then
				If .FileExists(strFile) Then
					.GetFile(strFile).Delete True
				End If
				
				strFile = objFile.Path
				dtDateCreatedNewest = objFile.DateCreated
			Else
				objFile.Delete True
			End If
		Next
		
		WScript.Echo strFile, dtDateCreatedNewest
	Else
		WScript.Echo "Folder [" & strFolder & "] not found."
	End If
End With

WScript.Quit 0
Это сообщение посчитали полезным следующие участники:

Отправлено: 15:36, 21-11-2013 | #2