Thanks
I wasn't sure as there is done on the next line
thats why I left it out. back in it goes

Works nicely, with the echoing of the percentage used , you can see that decrease until it meets the required level.
The end statement isn't like at the moment , but I'll sort that.
There is a flaw in my method as motion is feeding .jpg files in to one directory and .avi movie files in to another.
Should the level of .jpgs get too high , it will force over deletion of the movie files to recover space.
It will be a good learning exercise to modify it to stop that happening.
many thanks for the help