[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash script question



Jochen Schulz wrote:
Ken Irving:
If you want to remove the .svn/ directories and everything within them, something
like this should work (remove the 'echo' if the output looks ok):

  $ cd starting/directory
  $ find . -type d -name .svn -exec echo rm -r {} \;

GNU find also accepts the parameter (or better: operation) -detele so
you don't have to start an rm process for each file or deal with xargs.
That means you can just do (untested):

$ find . -type d -name .svn -delete

J.

Sorry to say, this is not so:

  mkdir -p xxx/yyy
  cp some files xxx
  cp some files xxx/yyy
  find xxx -type d -delete
  find: cannot delete xxx/yyy: Directory not empty
  find: cannot delete xxx: Directory not empty

I think, because you restricted the search to directories, it tries to delete the directories, which still have files because the 'find' ignored them.

--
Bob McGowan

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


Reply to: