# How do I find the size of a file?

**URL:** <https://discourse.julialang.org/t/how-do-i-find-the-size-of-a-file/61845>\
**Category:** New to Julia\
**Tags:** filesystem, file\
**Created:** [May 26, 2021, 10:50am UTC](https://discourse.julialang.org/t/how-do-i-find-the-size-of-a-file/61845 "2021-05-26T10:50:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Post date:** [May 26, 2021, 10:50am UTC](https://discourse.julialang.org/t/how-do-i-find-the-size-of-a-file/61845/1 "2021-05-26T10:50:17Z")

</div>

Hello,  
I have a file (“path/to/my/file/myfile”), and I wishes to know its size.

I try

```julia
filesize("path/to/my/file/myfile")

```

but only get `0` in output (which definitely is not its size). How do I get the filesize?

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [May 26, 2021, 11:06am UTC](https://discourse.julialang.org/t/how-do-i-find-the-size-of-a-file/61845/2 "2021-05-26T11:06:23Z")

</div>

```julia
help?> filesize
search: filesize

  filesize(path...)

  Equivalent to stat(file).size.

```

If you use `stat` you can see, if the path is correct:

```julia
julia> stat("path/to/my/file/myfile")
StatStruct(mode=0o000000, size=0)

```

as expected for this example. But for something existing:

```julia
julia> stat("c:\\Temp\\Test2.jl")
StatStruct(mode=0o100666, size=296)

```

---

<div class="post-metadata">

**Author:** ![Torkel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/torkel/32/5030_2.png) [@Torkel](https://discourse.julialang.org/u/Torkel)\
**Post date:** [May 26, 2021, 11:14am UTC](https://discourse.julialang.org/t/how-do-i-find-the-size-of-a-file/61845/3 "2021-05-26T11:14:20Z")

</div>

Ahh, that is a helpful approach. Thanks, yes, this should do.
