The online racing simulator
batch programming help please!
(13 posts, started )
batch programming help please!
Hey Guys,

I have a problem I can't seem to neither solve on my own, nor can I find anything on the internet that would help.
So I adress this here, where some smart minds are around...

maybe you know that I have a turtlecam (turtlecam.rediske.de) It uploads an image every minute to www and stores them locally too in a folder called
'turtlecam'

Now every night at 00:00h a batch files moves all the images into another folder 'turtlecamvideo' then a time lapse movie is being created from all the single images.
After that it is being uploaded automatically here:

turtlecam.rediske.de/tcdaily.avi

so far so good, but if you watch the movie you'll see all the blank images at night or when the lights are off. Whenever the lights are out the filesize drops to around 6kb as you can see here:



Now I'm looking for a batch solution that automatically deletes files by adjustable size...

Sounds easy but I couldn't find anything...

Can anyone help me please?

cheers,

AR
#2 - filur
http://www.php.net/get/php-5.2.5-Win32.zip/from/a/mirror

scriptfile.php

<?php 
php

foreach (glob('*.' .$argv[1]) as $file) {
    if (
FALSE !== filesize($file) && filesize($file) < $argv[2]) {
        
unlink($file);
    }
}


?>

batchfile.cmd

cd x:\path\to\pictures
x:\path\to\php.exe -f "x:\path\to\scriptfile.php" jpg 8192

Thanks mate I'll try this evening and will reply here...


Ok, I tried it right away with a test folder. The batch runs without error...

but it doesn't do anything, probably because I don't know how to tell the script the filesize... (I'm not a programmer you know)

what do I have to do if I want to, let's say delete all under 10kBytes?

please 1 step easier

cheers,

AR
my fault....

file type error made by myself

It works !!!!!!!!!

...but regarding the files you gave me: where is the filesize? How does it work? something with average right? but what if there's 22 hours of darkness (light bulb blown or something)



Thanks mate!

AR
#5 - Ian.H
Change the final cmdline arg.. for example:

x:\path\to\php.exe -f "x:\path\to\scriptfile.php" jpg 10240

What you're specifying here is running the script.php file, looking for .jpg files only that are less bytes in size than the number you specify



Regards,

Ian
the filesize is passed as the second argument of the scripts execution ($argv[2]) which in filurs example is 8192
Interesting setup
Quote from JamesF1 :Interesting setup

isn't it? ...it's like case modding but completely without a case!


...and it didn't work btw, but I tested it and found that the command 'cd d:\turtlecamvideo' didn't work in my batch file.
The reason it worked in my test was that I was on drive d: all the time. I had to split it up like

d:
cd turtlecamvideo

we'll see tonight!
Quote from rediske :isn't it? ...it's like case modding but completely without a case!


...and it didn't work btw, but I tested it and found that the command 'cd d:\turtlecamvideo' didn't work in my batch file.
The reason it worked in my test was that I was on drive d: all the time. I had to split it up like

d:
cd turtlecamvideo

we'll see tonight!

Should work on one line if you add a /d switch. I.e., cd /d d:\turtlecamvideo
Quote from NotAnIllusion :Should work on one line if you add a /d switch. I.e., cd /d d:\turtlecamvideo

I changed it now like in your post. followed by a 'c:' after the php-stuff to make sure

(cd /?, could have been so easy )

we'll see at around a quarter past midnight (gmt+1)
depending how fast this baby does:

http://turtlecam.rediske.de/turtlephoto4.htm

thank you all so far!
Very nice :0 I want one for my fish hehe

batch programming help please!
(13 posts, started )
FGED GREDG RDFGDR GSFDG