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

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

Ветеран


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

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


Как-то так:
читать дальше »
Код: Выделить весь код
@echo off
setlocal enableextensions enabledelayedexpansion

set sSourceFolder=C:\out\ss
set sDestFolder=C:\out_ftp\ss
set sMask=%~1
set sWinRARPath=%ProgramFiles%\WinRAR\WinRAR.exe

if exist "%sSourceFolder%\." (
	if exist "%sDestFolder%\." (
		if defined sMask (
			if exist "%sWinRARPath%" (
				echo %sMask%| >nul 2>&1 findstr.exe /i /r /c:"^[0-9][0-9][0-9][0-9][0-9][0-9]$" || (
					echo Date mask [%sMask%] probably error.
					exit /b 4
				)
				
				>nul 2>&1 dir /b "%sSourceFolder%\%sMask%*.*" || (
					echo Nothing found by Date mask [%sMask%*.*] in source folder [%sSourceFolder%].
					exit /b 6
				)
				
				"%sWinRARPath%" a -ep "%sDestFolder%\%sMask%ss.rar" "%sSourceFolder%\%sMask%*.*"
			) else (
				echo Can't find [%sWinRARPath%].
				exit /b 5
			)
		) else (
			echo Usage: %~nx0 ^<Date mask^>
			exit /b 3
		)
	) else (
		echo Can't find destination folder [%sDestFolder%].
		exit /b 2
	)
) else (
	echo Can't find source folder [%sSourceFolder%].
	exit /b 1
)


endlocal
exit /b 0

Сохраните код в файл с расширением «.cmd» в кодировке OEM/866. Маску даты указывайте параметром командного файла, например:
Код: Выделить весь код
"Мой путь\Пакетный файл.cmd" 140924

Отправлено: 04:59, 02-10-2014 | #6