# How to refactor a directory of dvc managed files?

**URL:** <https://discuss.dvc.org/t/how-to-refactor-a-directory-of-dvc-managed-files/875>\
**Category:** Questions\
**Created:** [September 3, 2021, 11:53pm UTC](https://discuss.dvc.org/t/how-to-refactor-a-directory-of-dvc-managed-files/875 "2021-09-03T23:53:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dvc.grasshopper](https://avatars.discourse-cdn.com/v4/letter/d/8baadc/32.png) [@dvc.grasshopper](https://discuss.dvc.org/u/dvc.grasshopper)\
**Post date:** [September 3, 2021, 11:53pm UTC](https://discuss.dvc.org/t/how-to-refactor-a-directory-of-dvc-managed-files/875/1 "2021-09-03T23:53:22Z")

</div>

I have a case where I created a directory of files that are individually managed by DVC (so there are a number of files, each with a corresponding .dvc file). I’d like to refactor this so that I just tell DVC to managed the entire directory and all of its contents to get rid of all those .dvc files cluttering things up.

I also have this situation in the recursive case (I’d like to tell DVC to just manage a directory parent and all ancestor contents).

What is the correct way to do this?

---

<div class="post-metadata">

**Author:** ![shcheklein](https://yyz1.discourse-cdn.com/flex035/user_avatar/discuss.dvc.org/shcheklein/32/173_2.png) [@shcheklein](https://discuss.dvc.org/u/shcheklein)\
**Post date:** [September 4, 2021, 12:02am UTC](https://discuss.dvc.org/t/how-to-refactor-a-directory-of-dvc-managed-files/875/2 "2021-09-04T00:02:31Z")

</div>

@dvc.grasshopper I think you can get rid of all the `.dvc` files and do `dvc add directory` instead. That should be it.

---

<div class="post-metadata">

**Author:** ![dvc.grasshopper](https://avatars.discourse-cdn.com/v4/letter/d/8baadc/32.png) [@dvc.grasshopper](https://discuss.dvc.org/u/dvc.grasshopper)\
**Post date:** [September 4, 2021, 12:06am UTC](https://discuss.dvc.org/t/how-to-refactor-a-directory-of-dvc-managed-files/875/3 "2021-09-04T00:06:53Z")

</div>

Ok, thanks. I will try that!
