# Downloads directory location

**URL:** https://discourse.julialang.org/t/downloads-directory-location/96420
**Category:** New to Julia
**Created:** [March 21, 2023, 9:12pm UTC](https://discourse.julialang.org/t/downloads-directory-location/96420 "2023-03-21T21:12:05Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![chadagreene](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chadagreene/32/34924_2.png) [@chadagreene](https://discourse.julialang.org/u/chadagreene)
#### Post date: [March 21, 2023, 9:12pm UTC](https://discourse.julialang.org/t/downloads-directory-location/96420/1 "2023-03-21T21:12:05Z")

</div>

I am confused about where files end up when I download them with [Downloads.jl](https://docs.julialang.org/en/v1/stdlib/Downloads/). Unfortunately there are no examples in the documentation to follow, so it’s hard to know what I’m doing wrong.

Here’s my attempt at downloading a 1 MB file:

```julia
using Downloads
my_file = "https://its-live-data.s3.amazonaws.com/velocity_image_pair/landsatOLI/v01/32607/LT05_L1TP_061018_19951015_20160925_01_T1_X_LT05_L1TP_062018_19950904_20160926_01_T1_G0240V01_P068.nc"
Downloads.download(my_file)

```

After running the code above, I am expecting to find the downloaded file in my current directory, but it’s not there. When I run the code above, it prints this line:

```julia
"/var/folders/3q/36tmwvtx50ldmv31f23wfz7w0000gq/T/jl_fe5urYZmHM"

```

which might suggest that `Downloads` put the file in a folder called `/var/folders...`, but I can’t find that directory on my computer.

The Downloads.jl documentation suggests that something like this might place the file in the current directory:

```julia
Downloads.download(my_file,output=pwd())

```

but the line above produces this error:

```julia
ERROR: MethodError: no method matching download(::String, ::Nothing; output="/Users/cgreene/Documents/MATLAB/data_testing")

```

I also found [this thread](https://discourse.julialang.org/t/how-do-i-use-downloads-download-to-download-to-a-custom-location/75322), which suggests the target location might be entered as the second argument to the downloads function like this:

```julia
Downloads.download(my_file,pwd())

```

but the above produces this error:

```julia
ERROR: IOError: rm("/Users/cgreene/Documents/MATLAB/data_testing"): directory not empty (ENOTEMPTY)

```

Does anyone know where files go when they’re downloaded by `Downloads.download()`? And is there a way to specify the target location?

---

<div class="post-metadata">

### Author: ![GunnarFarneback](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunnarfarneback/32/1827_2.png) [@GunnarFarneback](https://discourse.julialang.org/u/GunnarFarneback)
#### Post date: [March 21, 2023, 9:21pm UTC](https://discourse.julialang.org/t/downloads-directory-location/96420/2 "2023-03-21T21:21:05Z")

</div>

> [@chadagreene](#):
>
> I also found [this thread](https://discourse.julialang.org/t/how-do-i-use-downloads-download-to-download-to-a-custom-location/75322), which suggests the target location might be entered as the second argument to the downloads function like this:

I think you should try providing a filename instead of a directory.

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [March 21, 2023, 9:56pm UTC](https://discourse.julialang.org/t/downloads-directory-location/96420/3 "2023-03-21T21:56:22Z")

</div>

> [@chadagreene](#):
>
> ```julia
> Downloads.download(my_file,output=pwd())
> 
> ```
> 
> but the line above produces this error:
> 
> ```julia
> ERROR: MethodError: no method matching download
> 
> ```

That’s because the `output` argument is a positional argument, not a keyword argument (see the [documentation](https://docs.julialang.org/en/v1/stdlib/Downloads/#Downloads.download)). These are not the same in Julia, unlike Python. Also, the output argument is a filename, not a directory. Try:

```julia
Downloads.download(my_file, basename(my_file))

```

---

<div class="post-metadata">

### Author: ![chadagreene](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chadagreene/32/34924_2.png) [@chadagreene](https://discourse.julialang.org/u/chadagreene)
#### Post date: [March 21, 2023, 10:36pm UTC](https://discourse.julialang.org/t/downloads-directory-location/96420/4 "2023-03-21T22:36:36Z")

</div>

> [@GunnarFarneback](#):
>
> > [@chadagreene](#):
> >
> > I also found [this thread](https://discourse.julialang.org/t/how-do-i-use-downloads-download-to-download-to-a-custom-location/75322), which suggests the target location might be entered as the second argument to the downloads function like this:
> 
> I think you should try providing a filename instead of a directory.

**🤦** Thanks @GunnarFarneback.

---

<div class="post-metadata">

### Author: ![chadagreene](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chadagreene/32/34924_2.png) [@chadagreene](https://discourse.julialang.org/u/chadagreene)
#### Post date: [March 21, 2023, 10:37pm UTC](https://discourse.julialang.org/t/downloads-directory-location/96420/5 "2023-03-21T22:37:49Z")

</div>

Success! Here’s the working solution:

```julia
using Downloads
file_url = "https://its-live-data.s3.amazonaws.com/velocity_image_pair/landsatOLI/v01/32607/LT05_L1TP_061018_19951015_20160925_01_T1_X_LT05_L1TP_062018_19950904_20160926_01_T1_G0240V01_P068.nc"
target_directory = "/Users/cgreene/Documents/MATLAB/data_testing";
target_file = target_directory * "/" * basename(file_url)
Downloads.download(file_url,target_file)

```

Thanks @stevengj!

---

<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: [March 22, 2023, 2:45am UTC](https://discourse.julialang.org/t/downloads-directory-location/96420/6 "2023-03-22T02:45:58Z")

</div>

> <https://github.com/JuliaLang/Downloads.jl/pull/130>
>
> fix #121﻿

Still waiting for this to be merged so you don’t have to do the extension back yourself
