Just a quick request...
by FTIO from LinuxQuestions.org on (#50RMF)
Hi gang,
Since I had to move, the place I am now is not a good neighborhood. I've broke out the usb Logitech c615 I've had for a few years and have it set up with Motion using it.
Thing is, it's becoming a pain in the butt going through all the 'smaller' avi files in the directory I have it set to put them...I've learned pretty much what size a file needs to be to have anything 'important' going on in it.
So, I'd like to have a bash file that I can put on cron that will delete all the files in a particular directory that are 5MB and *smaller*, once an hour.
Would any of you programmer types feel like putting up a bash script that would do this for me, please?
I might could do what I needed, but have no idea how to make it check the size of a file.
I mean, would it be something like this?...
Code:#! /bin/bash
# Deleting all avi files 5MB and smaller in a directory
rm /home/me/vids -size -5M "*.avi" Like I said, I have no clue what I'm doing, but can *sometimes* pick things out of a small and/or simple script and figure out what I can play with until I understand how it works. I got the above by looking in the bash cookbook and right off showed 'size', so I just want to make sure I got it right or at least enough that it won't be too much trouble for anyone to quickly correct for me.


Since I had to move, the place I am now is not a good neighborhood. I've broke out the usb Logitech c615 I've had for a few years and have it set up with Motion using it.
Thing is, it's becoming a pain in the butt going through all the 'smaller' avi files in the directory I have it set to put them...I've learned pretty much what size a file needs to be to have anything 'important' going on in it.
So, I'd like to have a bash file that I can put on cron that will delete all the files in a particular directory that are 5MB and *smaller*, once an hour.
Would any of you programmer types feel like putting up a bash script that would do this for me, please?
I might could do what I needed, but have no idea how to make it check the size of a file.
I mean, would it be something like this?...
Code:#! /bin/bash
# Deleting all avi files 5MB and smaller in a directory
rm /home/me/vids -size -5M "*.avi" Like I said, I have no clue what I'm doing, but can *sometimes* pick things out of a small and/or simple script and figure out what I can play with until I understand how it works. I got the above by looking in the bash cookbook and right off showed 'size', so I just want to make sure I got it right or at least enough that it won't be too much trouble for anyone to quickly correct for me.