# dar package - howto exclude hidden directories [SOLVED]

## tps

Dear all

I am using package app-backup/dar to backup my gentoo box.

I would like to exclude the /root/.ccache directory with the following dar option:

-P root/.ccache

But when I run dar I see that files in /root/.ccache are added to the archive.

Any help would be appreciated.

ThanksLast edited by tps on Mon Dec 04, 2006 10:13 am; edited 1 time in total

----------

## 1veedo

Just a suggestion, I've never used dar before, but try doing this instead:

-P /root/.ccache

----------

## richfish

Assuming you use a filesystem that supports extended attributes (xfs, ext3), IMO the easiest way to exclude things from dar backups is to use the nodump option.

chattr -R +d /root/.ccache

dar --create ....  --nodump ...

Otherwise it might help to give the full dar command that you are executing.  FYI I am using "-P ./tmp/*" for one of my filesystems, which is working well.

----------

## tps

Thanks a lot - case solved!

----------

## halfgaar

 *Quote:*   

> Just a suggestion, I've never used dar before, but try doing this instead:
> 
> -P /root/.ccache

 

Dar wan't relative path names, so the lack of / is actually good.

tps, can I see your full dar command? It depends a bit on how you look at it, but the nodump thing is a bit of a kludge in my opinion, as you might skip files you didn't want to skip. I also would like to know why your --prune (-P) didn't work, as I don't have problems with it.

----------

## tps

Dear Halfgaar

This is my script to perform the dar-backup

```
#!/bin/sh

DIR=/usr/smb/backup

FILE=${DIR}/data

# Commands

echo .

echo ------------- start full backup -------------

date

echo Remove old full backup

rm $DIR/data.1.dar

echo New backup

if dar -c $FILE \

        --nodump \

        -R / \

        -P bin \

        -P boot \

        -P dev \

        -P lib \

        -P lost+found \

        -P mnt \

        -P opt \

        -P proc \

        -P sbin \

        -P sys \

        -P tmp \

        -P usr \

        -P var \

        -P root/\.ccache \

        -D \

        -v ; \

then echo "OK FULL BACKUP" ; \

else echo "ERROR FULL BACKUP" ; \

fi

```

I assumed -P did not work as all files in /root/.ccache were listed on screen as beeing added to backup when I run the script. I never checked if the files were actually in the archieve!

Thanks

----------

## halfgaar

Perhaps the problem is the escape before the dot. That shouldn't be necessary.

----------

## tps

Hi Halfgaar

Thanks - it works now

----------

