# Kopia diff output

**URL:** <https://kopia.discourse.group/t/kopia-diff-output/1088>\
**Category:** Support\
**Created:** [May 3, 2022, 10:16am UTC](https://kopia.discourse.group/t/kopia-diff-output/1088 "2022-05-03T10:16:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brechmos](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/brechmos/32/333_2.png) [@brechmos](https://kopia.discourse.group/u/brechmos)\
**Post date:** [May 3, 2022, 10:16am UTC](https://kopia.discourse.group/t/kopia-diff-output/1088/1 "2022-05-03T10:16:52Z")

</div>

I created a script that shows the differences between two snapshots. I have this on a few other machines and the output is what I expected.

On one machine I see “sizes differ” and “modification times differ” for the directory and file before showing the actual file.

```auto
Differences...
. sizes differ: 14683062451 14719911459
. modification times differ: 2022-05-01 04:04:05.890767099 -0400 EDT 2022-05-02 04:11:25.749159909 -0400 EDT
./Administrative sizes differ: 223152366 264688601
./Administrative modification times differ: 2022-04-27 04:06:22.529734951 -0400 EDT 2022-05-02 04:11:24.145131802 -0400 EDT

```

How do I remove those “extra” lines containing “sizes differ” and “modification times differ” that show directory changes?

Code is here:

```auto
SPENT=`$KOPIA snapshot list -l | tail -1 | head -1 | cut -d\ -f6`
SLAST=`$KOPIA snapshot list -l | tail -2 | head -1 | cut -d\ -f6`

echo " "
echo "Differences..."
$KOPIA diff $SLAST $SPENT

```

I am using:

```auto
0.10.7 build: 5d87d817335f6d547e094ab80062113dc3a1fdf4 from: kopia/kopia

```

---

<div class="post-metadata">

**Author:** ![iBackup](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/ibackup/32/355_2.png) [@iBackup](https://kopia.discourse.group/u/iBackup)\
**Post date:** [May 3, 2022, 10:22pm UTC](https://kopia.discourse.group/t/kopia-diff-output/1088/2 "2022-05-03T22:22:31Z")

</div>

I think this question more suitable for stackoverflow

This should do what you want I guess

```bash
#!/bin/sh                                                                                                                                                                          
                                                                                                                                                                                   
kopia snapshot list -l | awk '{p=l; l=$4}                                                                                                                                          
END{                                                                                                                                                                               
  cmd = "kopia diff " p " " l                                                                                                                                                      
                                                                                                                                                                                   
  while( (cmd | getline) > 0) {                                                                                                                                                    
    if ( $0 !~ /^(removed|added|changed)/) continue;                                                                                                                               
    print;                                                                                                                                                                         
  }                                                                                                                                                                                
}                                                                                                                                                                                  
'

```

---

<div class="post-metadata">

**Author:** ![brechmos](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/brechmos/32/333_2.png) [@brechmos](https://kopia.discourse.group/u/brechmos)\
**Post date:** [May 4, 2022, 12:41am UTC](https://kopia.discourse.group/t/kopia-diff-output/1088/3 "2022-05-04T00:41:28Z")

</div>

Well, I went with the simpler:

```auto
$KOPIA diff $SLAST $SPENT | grep -v "modification times differ" | grep -v "sizes differ"

```

I thought there was a flag that was set that was showing directory differences rather than just file differences.

---

<div class="post-metadata">

**Author:** ![iBackup](https://yyz2.discourse-cdn.com/free1/user_avatar/kopia.discourse.group/ibackup/32/355_2.png) [@iBackup](https://kopia.discourse.group/u/iBackup)\
**Post date:** [May 4, 2022, 12:51pm UTC](https://kopia.discourse.group/t/kopia-diff-output/1088/4 "2022-05-04T12:51:01Z")

</div>

> [@brechmos](#):
>
> I thought there was a flag that was set that was showing directory differences rather than just file differences.

If you wouldn’t ignore `sizes differ` then the first line produced by

```auto
kopia diff oldID newID | head -n1

```

would give you total difference between two snapshots.

The same is true for directories difference, it shows side by side old and new size, so if you would parse kopia’s diff outcome for particular directories, you can filter out only size difference for those particular directories.
