Raja G
Raja G

Reputation: 6673

How to exclude a directory with find and cp commands in linux

I am trying to exclude the service01_001/tmp directory while taking backup of the service folder using below command, but end result include service01_001/tmp

find /app/service -path "./tmp" -prune -o -name "service01_001" -exec cp -rp '{}' /app/temp/ \;

Note: I tried with cp command, but due to the dynamic content and temporary content the command cp -rp source target sometimes failing due to data missing from the service01_001/tmp

Upvotes: 0

Views: 28

Answers (0)

Related Questions