1.

Solve : Batch Challenge ??

Answer»

Hi everyone,

I love creating Batch File in Ms dos LANGUAGE but today i am in FRONT of a big problem.

Here is a list of files :
01135755.582 07/20/2006
01135842.326 06/20/2006
01135927.656 05/20/2006
01136187.328 02/20/2006
.....

I have plenty of this and everyday the SOFTWARE is creating new ones.

I try do make a batch which main GOAL is to take the most recent files and to copy it in a specified folder.

AS i am returning all ms ds command, i don't manage to make it.

Can you help me ?

Regards ,
OK I find out myself :

Code: [Select]@echo off
set repun="C:\RELCPT\RELCPT\"
set repdeux="C:\RELCPT\"
set nomdest="Le_plus_recent.txt"

set /a count=0

if exist "%repun%*.*" for /f "delims=" %%a in ('dir /od /b "%repun%*.*"') do (
set variable=%%a
set /a count+=1
)

echo les fichier le plus recent EST %variable%
echo il y a %count% fichiers dans ce repertoire
if %count% GEQ 2 copy "%repun%%variable%" %repdeux%%nomdest%



Discussion

No Comment Found