update: typo in the code, problem fixed. but now i notice a new problem. when i run this command, i meant to remove everything older then 2013-jan-10 (20130110). but it seems to have removed itself and a whole bunch of files instead. the reason why i said it removed itself is because i couldn't find it that directory afterwards.
so the new question is: a mtime of 20130110 would remove everything prior to that or everything on that date or everything post that date?
i modified my code to print line by line
[CODE]deleting file number 2 which is named /tmp/delete.sh
IT is somehow removing my files from before that date:
deleting file number 26 which is named /tmp/A20130104.0525-0530
I have this script that i have modified, original is found on some linux/unix forum. but when i run it it is giving me errors.
It should do two things: based on a time of the file, give it write permission, and then delete it.
for files in `find /path-to-folder -mtime -20130110 -print`
echo "Deleting file $file"
chmod +w $files
delcnt=$(($delcnt + 1))
echo "deleted $delcnt files"
the result is this:
chmod: missing operand after `+w'
Try `chmod --help' for more information.
rm: missing operand
Try `rm --help' for more information.
So i know that somehow, the $file variable is empty but i don't know why.