> You are doing it wrong. > > Each command has something between ``, so bash is expanding that > entire list and just before feeding the whole lot to find, realizes > that the list is longer than 65,536 characters. It's bash that is > returning that error, not find. > > You're mistake is trying to marrow down *where* find should look > instead of *what* it should look for. > > You something like this: > > find /home/user -type f -name "`/bin/date -d 'yesterday' > +\%Y\%m\%d`*.jpg`" > > See the difference? That will not produce a gigantic command line, it > will produce a rather short one and find will check each file it finds > one by one and see if it's name matches the supplied pattern. > > Word of warning: DO NOT blindly run -delete on this, first check the > total output and make sure it only has what you want to delete. As > with all things concerning rm or file deletion, the burden rests on > you to make completely sure you delete only what you want to delete.
I ran this and the output was voluminous but looked good: /usr/bin/find /home/user -type f -name "*-`/bin/date -d 'yesterday' +\%Y\%m\%d`*.jpg" So I ran it again, adding -delete right before -type. After a lot of processing I got a line of output like this for each file: /usr/bin/find: `/home/user/1-2011071612345.jpg': No such file or directory Unfortunately the command actually deleted the entire /home/user folder. Can anyone tell me what went wrong? Maybe '/home/user' was at the very top of the long list that scrolled up the screen when I ran the find command without -delete? - Grant