Hi,
I want to remove a directory recursively except the inside directories calles .SYNC (designsync dirs) I am looking for something like:
\rm -rf < find . * | grep -v .SYNC
The find works ok but I do not know how to redirect it.
Please help.
Regards,
Ziv
cd /path/to/directory
rm -rf $(find . * | grep -v .SYNC)
This will work but it is REALLY dangerous. Be careful.
rdcwayx
3
What's the meaning to put a * in your find script?
your request can be combined into one command:
find . ! -name "*.SYNC" -type f -exec echo rm -rf {} \;
if you review the output, and it is fine, then run below command to delete files.
find . ! -name "*.SYNC" -type f -exec rm -rf {} \;