# Rename multiple files in the folder with Julia

**URL:** <https://discourse.julialang.org/t/rename-multiple-files-in-the-folder-with-julia/57976>\
**Category:** Data\
**Tags:** filesystem\
**Created:** [March 25, 2021, 10:35pm UTC](https://discourse.julialang.org/t/rename-multiple-files-in-the-folder-with-julia/57976 "2021-03-25T22:35:15Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![feanor12](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/feanor12/32/8212_2.png) [@feanor12](https://discourse.julialang.org/u/feanor12)\
**Post date:** [March 25, 2021, 10:46pm UTC](https://discourse.julialang.org/t/rename-multiple-files-in-the-folder-with-julia/57976/2 "2021-03-25T22:46:15Z")

</div>

You can get a list of file names using `readdir`. From there you can iterate over all the files and call `mv` to rename them.

```julia

files = readdir()
txt_files = filter(endswith(".txt"),files)
for (i,file) in enumerate(txt_files)
   mv(file,"$(i).txt")
end

```

---

_[View the full topic](https://discourse.julialang.org/t/rename-multiple-files-in-the-folder-with-julia/57976)._
