You need to reformat your command a bit for it to work.
Try this:
find "/home/user/videos folder" -name "*.avi" -mtime +7 -exec rm -f {} \;
Or, in GNU find, to achieve the same thing without -exec:
find "/home/user/videos folder" -name "*.avi" -mtime +7 -delete
The first argument to find is the folder to look in - you shouldn't try and put your entire filter in here, just the starting point. Then use -name
to tell it what pattern to look for. You can try this without the -exec
or -delete
first until you are satisified, then you won't do any damage by trying it.
Enclosing an argument in quotes basically stops the shell from messing with it. If you use -name *.avi
, then the argument that find
will see could be anything, because the shell will parse it (and replace it with the contents of the current directory that end in .avi) before calling find
. This is usually bad and will lead to unexpected results. find
knows how to parse *
itself.