# How to track file

**URL:** <https://discuss.dvc.org/t/how-to-track-file/739>\
**Category:** Questions\
**Created:** [April 28, 2021, 12:36pm UTC](https://discuss.dvc.org/t/how-to-track-file/739 "2021-04-28T12:36:37Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![merve](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@merve](https://discuss.dvc.org/u/merve)\
**Post date:** [April 28, 2021, 12:36pm UTC](https://discuss.dvc.org/t/how-to-track-file/739/1 "2021-04-28T12:36:37Z")

</div>

hello,

ı couldn’t track my folder. What am I doing wrong ?

My folder hiearchy

Folder  
-01

ı m using “dvc add Folder” comment.  
then ı added to git.  
git tag -a “v1” -m “message”

then ı added other file to Folder.  
New data hiearchy is

Folder  
-01  
-02  
-03

ı repeated same things.

dvc add Folder  
git add Folder.dvc  
git tag -a “v1.1” -m “message”

then ı check the tag v1 ı want to see just 01 file in folder but ı saw 01 02 and 03 file. Why? What am I doing wrong ?

---

<div class="post-metadata">

**Author:** ![kupruser](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@kupruser](https://discuss.dvc.org/u/kupruser)\
**Post date:** [April 28, 2021, 12:43pm UTC](https://discuss.dvc.org/t/how-to-track-file/739/2 "2021-04-28T12:43:38Z")

</div>

Hi @merve !

Did you run `dvc checkout` after `git checkout`?

---

<div class="post-metadata">

**Author:** ![merve](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@merve](https://discuss.dvc.org/u/merve)\
**Post date:** [April 28, 2021, 12:57pm UTC](https://discuss.dvc.org/t/how-to-track-file/739/3 "2021-04-28T12:57:00Z")

</div>

yes, ı forgot to mention,sorry. Also I push to git repo.  
I changed my branch and tag then ı writing dvc checkout but it is not change .

---

<div class="post-metadata">

**Author:** ![kupruser](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@kupruser](https://discuss.dvc.org/u/kupruser)\
**Post date:** [April 28, 2021, 12:58pm UTC](https://discuss.dvc.org/t/how-to-track-file/739/4 "2021-04-28T12:58:27Z")

</div>

> [@merve](#):
>
> Folder.dvc

When you git checkout to a different version, does the content of Folder.dvc change?

---

<div class="post-metadata">

**Author:** ![merve](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@merve](https://discuss.dvc.org/u/merve)\
**Post date:** [April 28, 2021, 1:04pm UTC](https://discuss.dvc.org/t/how-to-track-file/739/5 "2021-04-28T13:04:08Z")

</div>

yes when ı git checkout a different version and then dvc checkout my folder.dvc is changing

---

<div class="post-metadata">

**Author:** ![kupruser](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@kupruser](https://discuss.dvc.org/u/kupruser)\
**Post date:** [April 28, 2021, 3:56pm UTC](https://discuss.dvc.org/t/how-to-track-file/739/6 "2021-04-28T15:56:24Z")

</div>

And if you delete `folder` itself and run `dvc checkout`, does it restore your folder as you expect? Also, please show `dvc doctor` output.

---

<div class="post-metadata">

**Author:** ![merve](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@merve](https://discuss.dvc.org/u/merve)\
**Post date:** [April 30, 2021, 5:51am UTC](https://discuss.dvc.org/t/how-to-track-file/739/7 "2021-04-30T05:51:55Z")

</div>

when I deleted folder itself and then dvc checkout, folder is restore but it is empty ☹

---

<div class="post-metadata">

**Author:** ![kupruser](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@kupruser](https://discuss.dvc.org/u/kupruser)\
**Post date:** [April 30, 2021, 6:17pm UTC](https://discuss.dvc.org/t/how-to-track-file/739/8 "2021-04-30T18:17:33Z")

</div>

Looks like there is some misunderstanding here. Would you be able to create a minimal reproducible example for this issue?

---

<div class="post-metadata">

**Author:** ![merve](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@merve](https://discuss.dvc.org/u/merve)\
**Post date:** [May 24, 2021, 7:04am UTC](https://discuss.dvc.org/t/how-to-track-file/739/9 "2021-05-24T07:04:21Z")

</div>

My folder hierarhy is comletely below.

-DATASET  
-plate  
-01  
-images  
- 1.jpg  
- 2.jpg  
-labels  
- 1.txt  
- 2.txt

then my steps;

git init  
git remote add origin “”  
dvc remote add -d dvcremote “”  
dvc add plate  
git add plate.dvc  
git commit -m “plate data added.”  
dvc push  
git push -u origin master

then, ı have added to folder 02 under the plate folder. 02 folder hierarcy is,  
-02  
-images  
- 1.jpg  
- 2.jpg  
-labels  
- 1.txt  
- 2.txt

then ı repeated steps.

dvc add plate  
git add plate.dvc  
git commit -m “plate dataset updated.”  
dvc push  
git push -u origin master

then, onother person want to pull the data according to commit.  
he checked the commit and go to plate dataset addded commit

git checkout xxxxxx  
dvc checkout

he want to see just 01 folder. Okay there is no problem.  
then he checked another commit plate dataset updated.

git checkout wwwww  
dvc checkout

and he saw the 01 and 02 folder. Okay, also there is no problem.

then he want to check again first plate dataset added commit

git checkout xxxxxx  
dvc checkout

but he saw the 01 and 02 folders again, but he want see the just 01 folder under the plate folder. Right ?

What is the reason? what is the wrong step is here ?

---

<div class="post-metadata">

**Author:** ![isidentical](https://avatars.discourse-cdn.com/v4/letter/i/c68b51/32.png) [@isidentical](https://discuss.dvc.org/u/isidentical)\
**Post date:** [May 24, 2021, 8:07am UTC](https://discuss.dvc.org/t/how-to-track-file/739/10 "2021-05-24T08:07:02Z")

</div>

Can you share the logs for the `dvc checkout`. As well as the existence of `02.dvc` file.

---

<div class="post-metadata">

**Author:** ![merve](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@merve](https://discuss.dvc.org/u/merve)\
**Post date:** [May 24, 2021, 9:20am UTC](https://discuss.dvc.org/t/how-to-track-file/739/11 "2021-05-24T09:20:00Z")

</div>

when I wrote a dvc checkout ı couldnt see any log.  
It occurs plate.dvc everytime, because ı tracked this plate folder. then ı checked plate.dvc files according to differents commit. these plate.dvc files are different eachother.

---

<div class="post-metadata">

**Author:** ![jorgeorpinel](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dvc.org/jorgeorpinel/32/46_2.png) [@jorgeorpinel](https://discuss.dvc.org/u/jorgeorpinel)\
**Post date:** [May 24, 2021, 6:36pm UTC](https://discuss.dvc.org/t/how-to-track-file/739/12 "2021-05-24T18:36:54Z")

</div>

> [@merve](#):
>
> he saw the 01 and 02 folders again, but he want see the just 01 folder under the plate folder.  
> What is the reason? what is the wrong step is here ?

@merve I just tried this and indeed both directories are left in there, but `plate/02/` would be empty. Can you confirm this is what you see too?

My last steps:

```console
$ tree
.
├── plate
│ ├── 01
│ │ └── data
│ └── 02
│ └── data
└── plate.dvc
$ git checkout HEAD^
$ dvc checkout
M plate/
$ tree
.
├── plate
│ ├── 01
│ │ └── data
│ └── 02
└── plate.dvc

```

TBH I’m not sure whether DVC should be removing that directory. @kupruser @isidentical ?

---

<div class="post-metadata">

**Author:** ![merve](https://avatars.discourse-cdn.com/v4/letter/m/f07891/32.png) [@merve](https://discuss.dvc.org/u/merve)\
**Post date:** [May 24, 2021, 8:10pm UTC](https://discuss.dvc.org/t/how-to-track-file/739/13 "2021-05-24T20:10:38Z")

</div>

yes now i noticed. but why the plate/ 02 directory is not removed? This causes confusion. I shouldn’t always check if the folder is empty, right?

---

<div class="post-metadata">

**Author:** ![kupruser](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@kupruser](https://discuss.dvc.org/u/kupruser)\
**Post date:** [May 24, 2021, 8:13pm UTC](https://discuss.dvc.org/t/how-to-track-file/739/14 "2021-05-24T20:13:54Z")

</div>

Hi guys,

That checkout behavior is a known bug [dvc checkout will leave empty folders · Issue #2397 · iterative/dvc · GitHub](https://github.com/iterative/dvc/issues/2397)
