0

I'm quite ignorant when it comes to linux commands. I found this line in a post-receive setting in my git production hook.

find /home/app/myapp.com/app/tmp/cache -type f -exec rm {} \;

Inside that /app/tmp/cache folder is a bunch of other subfolders as follow:

models/
views/
persistent/
graphs/

Now, I want that command to exclude the graphs/ subfolder, but not sure how to rewrite that command.

Could anyone help?

1
  • 1
    That find command will not feed any directory to the rm command, due to the -type f parameter, which practically tells find to only touch files.
    – Larssend
    Nov 24, 2015 at 4:56

1 Answer 1

1

try

find  /home/app/myapp.com/app/tmp/cache \( -name graphs -prune \) -o -type f -delete

where

  • \( -name graphs -prune \) tells find to skip graphs
  • -o -type f -delete or else, delete files.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .