first working version including moving the file on insufficient space
error