# DVC doesn't seem to notice that I delete or restore a folder

**URL:** <https://discuss.dvc.org/t/dvc-doesnt-seem-to-notice-that-i-delete-or-restore-a-folder/1590>\
**Category:** Questions\
**Created:** [April 10, 2023, 2:55pm UTC](https://discuss.dvc.org/t/dvc-doesnt-seem-to-notice-that-i-delete-or-restore-a-folder/1590 "2023-04-10T14:55:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JohnAtl](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dvc.org/johnatl/32/365_2.png) [@JohnAtl](https://discuss.dvc.org/u/JohnAtl)\
**Post date:** [April 10, 2023, 2:55pm UTC](https://discuss.dvc.org/t/dvc-doesnt-seem-to-notice-that-i-delete-or-restore-a-folder/1590/1 "2023-04-10T14:55:45Z")

</div>

This is probably a bug in my wetware, but I don’t understand what’s happening here.

```bash
dev on git by-19-channels [$] via conda company 
> ll data/production_models 
total 256K
drwxr-xr-x 1 john john 152 Apr 10 10:37 .
drwxr-xr-x 1 john john 294 Apr 10 10:36 ..
drwxrwxr-x 1 john john 18 Apr 10 09:59 epi_46621521
drwxr-xr-x 1 john john 30 Apr 6 10:04 cond_202304041327
drwxr-xr-x 1 john john 120 Apr 10 10:04 epi_mc_202304061050
-rw-rw-r-- 1 john john 249K Apr 10 10:04 pcaer.pkl
-rw-rw-r-- 1 john john 1.2K Apr 10 10:04 transformer.pkl

```

I move epi\_46621521 to the Trash using the file browser.

```bash
dev on git by-19-channels [$] via conda company 
> ll data/production_models
total 256K
drwxr-xr-x 1 john john 128 Apr 10 10:38 .
drwxr-xr-x 1 john john 294 Apr 10 10:36 ..
drwxr-xr-x 1 john john 30 Apr 6 10:04 cond_202304041327
drwxr-xr-x 1 john john 120 Apr 10 10:04 epi_mc_202304061050
-rw-rw-r-- 1 john john 249K Apr 10 10:04 pcaer.pkl
-rw-rw-r-- 1 john john 1.2K Apr 10 10:04 transformer.pkl

dev on git by-19-channels [$] via conda company 
> dvc status
Data and pipelines are up to date.                                                                                                                                                                                                                          

```

DVC didn’t seem to notice.  
I restore the folder from the trash.

```bash
dev on git by-19-channels [$] via conda company 
> ll data/production_models
total 256K
drwxr-xr-x 1 john john 152 Apr 10 10:38 .
drwxr-xr-x 1 john john 294 Apr 10 10:36 ..
drwxrwxr-x 1 john john 18 Apr 10 09:59 epi_46621521
drwxr-xr-x 1 john john 30 Apr 6 10:04 cond_202304041327
drwxr-xr-x 1 john john 120 Apr 10 10:04 epi_mc_202304061050
-rw-rw-r-- 1 john john 249K Apr 10 10:04 pcaer.pkl
-rw-rw-r-- 1 john john 1.2K Apr 10 10:04 transformer.pkl

dev on git by-19-channels [$] via conda company 
> dvc status               
Data and pipelines are up to date.                                                                                                                                                                                                                          

```

Again, DVC didn’t notice a change.  
I try just `rm`ing the folder.

```bash
dev on git by-19-channels [$] via conda company 
> rm -rf data/production_models/epi_46621521 

dev on git by-19-channels [$] via conda company 
> dvc status
Data and pipelines are up to date.                                                                                                                                                                                                                          

```

And DVC didn’t notice that either.

Just as a sanity check:

```bash
dev on git by-19-channels [$] via conda company 
> touch data/production_models/test.txt

dev on git by-19-channels [$] via conda company 
> dvc status
data.dvc:                                                                                                                                                                                                                                                   
	changed outs:
		modified: data

dev on git by-19-channels [$] via conda company 
> rm data/production_models/test.txt 

dev on git by-19-channels [$] via conda company 
> mkdir data/production_models/test

dev on git by-19-channels [$] via conda company 
> dvc status
Data and pipelines are up to date.                                                                                                                                                                                                                          

dev on git by-19-channels [$] via conda company 
> 

```

I must be missing something, right?

```plaintext
DVC 2.51.0
Linux pop-os 6.2.6-76060206-generic #202303130630~1679424972~22.04~4a8cde1 SMP PREEMPT_DYNAMIC Tue M x86_64 x86_64 x86_64 GNU/Linux

```

---

<div class="post-metadata">

**Author:** ![david.waterworth](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@david.waterworth](https://discuss.dvc.org/u/david.waterworth)\
**Post date:** [April 13, 2023, 4:56am UTC](https://discuss.dvc.org/t/dvc-doesnt-seem-to-notice-that-i-delete-or-restore-a-folder/1590/2 "2023-04-13T04:56:11Z")

</div>

I’m not 100% sure how it’s supposed to work either, but when I track a folder rather than an individual file I see similar behaviour. In order for it to work properly I find I have to

dvc add folder

(where folder is a folder with an associated folder.dvc file)

every time files in a tracked folder are added/deleted or changed.

Its quite annoying, I’d originally assumed DVC would automatically scan for changes but it doesn’t appear to (maybe this is a bug)?

---

<div class="post-metadata">

**Author:** ![JohnAtl](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dvc.org/johnatl/32/365_2.png) [@JohnAtl](https://discuss.dvc.org/u/JohnAtl)\
**Post date:** [April 13, 2023, 5:37am UTC](https://discuss.dvc.org/t/dvc-doesnt-seem-to-notice-that-i-delete-or-restore-a-folder/1590/3 "2023-04-13T05:37:35Z")

</div>

I think the problem was the folders were empty, which I didn’t realize.  
So it seems folders aren’t tracked unless they have files within. Or maybe as you said, if they have a .dvc file.
