<html><body>Hi Dominic,<br /><br />Thanks you very much for replying.<br /><br />On 20 September 2011 08:57, Dominic Humphries &lt;linux@oneandoneis2.org&gt; wrote:<br />&gt; Looks like you could use:<br />&gt;<br />&gt; $ find /home/fay/ -path '/home/fay/[^\.]*~' -exec rm '{}' \; -print<br />&gt;<br />&gt; to do what you want.<br /><br />Yes, that works perfectly, and it makes perfect sense now I see the <br />command. Thanks so much :-)<br /><br /><br />&gt; For your other issue, you can probably do it cleverly with find, but in<br />&gt; the interests of just getting it done, I would just use backticks to<br />&gt; string a couple of commands together to do this:<br />&gt;<br />&gt; ls -l `find . -name 'form' | grep -v 'dir1' | grep -v 'dir2'`<br />&gt;<br />&gt; This will run the find command to get all 'form' files, then pipes that<br />&gt; output through two greps to remove dir1 &amp; dir2; then the output of THAT<br />&gt; is sent to 'ls' in this case to show you all the files it has found.<br /><br />Here, I've done some testing and there is a scenario I didn't <br />properly explain.<br /><br />Looking for filenames containing the word 'list'.<br /><br />Because so many filenames contain the name 'list' I'll use 'listit' <br />instead to simplify the test.<br /><br />So these are my test files:<br /><br />/home/fay/Downloads/dokuwiki/loads-of-files-containing-listit.txt<br />/home/fay/Documents/what_to_buy/listit/testlistit.html<br />/home/fay/Documents/what_to_buy/listit/webcam.html<br />/home/fay/listit/january_listit.txt<br /><br />I want to exclude the 'Downloads' folder and 'listit' which is a sub <br />sub folder in another folder.<br />I only want to return the single result 'testlistit.html'.<br /><br />$ find . -name '*listit*'<br /><br />./Downloads/docuwiki/loads-of-files-containing-listit.txt<br />./Documents/how_to_choose_what_to_buy/listit<br />./Documents/how_to_choose_what_to_buy/listit/testlistit.html<br />./listit<br />./listit/january_listit.txt<br /><br />So far, so good.<br /><br />$ find . -name '*listit*' | grep -v 'Downloads'<br /><br />./Documents/how_to_choose_what_to_buy/listit<br />./Documents/how_to_choose_what_to_buy/listit/testlistit.html<br />./listit<br />./listit/january_listit.txt<br /><br />Still good: excludes the Downloads folder.<br /><br />$ find . -name '*listit*' | grep -v 'Downloads' | grep -v 'listit'<br /><br />Returns nothing of course.<br /><br />$ ls -l `find . -name '*listit*' | grep -v 'Downloads' | grep -v 'listit'`<br /><br />What I don't understand about this command is that it just returns an <br />alphabetised list of the root folders and files inside /home/fay<br /><br /><br />I've tried various commands to achieve the exclusion of /home/fay/listit/ <br />(without excluding /home/fay/Documents/what_to_buy/listit/) but <br />nothing has worked so far.<br /><br /><br />
                Best Regards,<br />Fay<br />East Grinstead Linux User Group<br />www.eglug.org.uk<br /><br /></body></html>