file check

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
acun
Posts: 3
Joined: 02 Nov 2010 02:46

file check

#1 Post by acun » 02 Nov 2010 03:09

hello there

I need some advice from u guys.
I'm not a programmer but i can't find a program (free) to do what i want so i tried to do whatever i can to make my work easier.
I need a batch to loop in a directory to find certain files and if the extension is found to call another bat and do the job.
The problem is about the size of the files, if i upload the file in ftp, my bat find extension and fire up the second bat. But the file is not complete uploaded and i have lot's of errors.
After some time researching i thought the only way is to compare size of the file.

I adapted this code to my needs(i'm sure is wrong but now it works):

:1
sleep 5
for /f %%a IN (' dir %source%\*.avi /b dir %source%\*.mpg /b') do set namec=%%~na%%~xa
if "%namec%"=="" goto 1
echo %namec%
set "filemask=D:\ftp\test\*.*"
for %%B in (%filemask%) do set size=%%~zB
for %%c in (%filemask%) do set ext=%%~xc
for %%e in (%filemask%) do set name=%%~ne
sleep 5
set "filemask1=D:\ftp\test\*.*"
for %%D in (%filemask1%) do set sizeo=%%~zD
if %size%==%sizeo% call encode.bat %name% %namec%

rem sleep 5
goto :1

So, is there another way to do that?
Thank u.

Acun

Post Reply