# Error while moving files :name too long (ENAMETOOLONG)

**URL:** <https://discourse.julialang.org/t/error-while-moving-files-name-too-long-enametoolong/106377>\
**Category:** General Usage\
**Tags:** filesystem, io\
**Created:** [November 17, 2023, 5:59pm UTC](https://discourse.julialang.org/t/error-while-moving-files-name-too-long-enametoolong/106377 "2023-11-17T17:59:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![raman\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raman_kumar/32/26782_2.png) [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)\
**Post date:** [November 17, 2023, 5:59pm UTC](https://discourse.julialang.org/t/error-while-moving-files-name-too-long-enametoolong/106377/1 "2023-11-17T17:59:14Z")

</div>

I am getting `name too long (ENAMETOOLONG)` when i try to move file from one folder to another.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/7/a/7a5711eb4d689751fa3d3c2a69b33a27c29188b7.png)

My code is as given below 🥱

```julia
`for i in 1:length(IO)
	mat=match(r".+beta-(\d.\d+)_betaerr(\d.\d+)",IO[i])
	if mat==nothing 
		continue
	end
	ind=tryparse(Float64,mat.captures[1])
	#@show typeof(ind)
	err=tryparse(Float64,mat.captures[2])	
	@show typeof(err)
	print("$err\t")
	if err>ind; continue; end
	if ind<=3.5
	mv("/home/raman/runs_20231114/$IO[i]","/home/raman/GoodPlots/$IO[i]",force=true)
	end
end`

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/2/e/2eb92f34000ca16ac08c408300d3569af25cc334.png)

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [November 17, 2023, 6:07pm UTC](https://discourse.julialang.org/t/error-while-moving-files-name-too-long-enametoolong/106377/2 "2023-11-17T18:07:33Z")

</div>

well, your file name is too long:

> <https://stackoverflow.com/questions/6571435/limit-on-file-name-length-in-bash>

---

<div class="post-metadata">

**Author:** ![tamasgal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamasgal/32/27946_2.png) [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Post date:** [November 17, 2023, 9:09pm UTC](https://discourse.julialang.org/t/error-while-moving-files-name-too-long-enametoolong/106377/3 "2023-11-17T21:09:14Z")

</div>

You are using the whole `IO` (whatever that is, I assume a list of filenames by looking at the error above) in the string interpolation:

```julia
mv("/home/raman/runs_20231114/$IO[i]","/home/raman/GoodPlots/$IO[i]",force=true)

```

since the `[i]` is not picked up. You can also see it in the syntax colouring, the `[i]` appears red (in your editor-- in the screenshot above --it’s blue).

This means that the whole `IO` array is dumped into your `mv` command, which is obviously too long.

You need to use parentheses to include that in the interpolation:

```julia
mv("/home/raman/runs_20231114/$(IO[i])","/home/raman/GoodPlots/$(IO[i])",force=true)

```

as you can see `$(IO[i])` is now “black” that’s what gets replaced by the `i`th value of `IO`.
