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

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

Ветеран


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

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


Serg2010, WSH устроит?
читать дальше »
Код: Выделить весь код
Option Explicit

Dim strFolder
Dim strExtension

Dim objFile
Dim dtDateCreated


With WScript.Arguments
	If .Count <> 2 Then
		WScript.Echo "Usage: cscript.exe //nologo """ & WScript.ScriptFullName & """ ""<Path>"" ""<mask>"""
		WScript.Quit 1
	Else
		strFolder = .Item(0)
		strExtension   = .Item(1)
	End If
End With

With WScript.CreateObject("Scripting.FileSystemObject")
	If .FolderExists(strFolder) Then
		For Each objFile In .GetFolder(strFolder).Files
			If UCase(.GetExtensionName(objFile.Name)) = UCase(strExtension) Then
				dtDateCreated = objFile.DateCreated
				
				objFile.Name = _
					Align(Year  (dtDateCreated), 4) & "_" & _
					Align(Month (dtDateCreated), 2) & "_" & _
					Align(Day   (dtDateCreated), 2) & "_" & _
					Align(Hour  (dtDateCreated), 2) & "_" & _
					Align(Minute(dtDateCreated), 2) & "_" & _
					Align(Second(dtDateCreated), 2) & "_" & _
					objFile.Name
			End If
		Next
	Else
		WScript.Echo "Folder [" & strFolder & "] not found"
	End If
End With

WScript.Quit 0

Function Align(anyValue, lngWidth)
	Align = Right(String(lngWidth, "0") & CStr(anyValue), lngWidth)
End Function

Первым аргументом указываете путь, вторым — расширение.

Отправлено: 22:53, 09-04-2012 | #2