cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Our new Dropbox updates make your online life easier. See how you can store online-only files, edit photos in Dropbox and annotate PDFs with these updates.

View, download, and export

Need support with viewing, downloading, and exporting files and folders from your Dropbox account? Find help from the Dropbox Community.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to make sure Dropbox link whether it can download

how to make sure Dropbox link whether it can download

alicera
Explorer | Level 3

here is the code

 

```

if wget -q --method=HEAD ftp://ftp.somewhere.com/bigfile.gz;
then
echo "This page exists."
else
echo "This page does not exist."
fi

```

I try to use correct link and incorrect link  (dropbox)

It is still return "This page exists."

Desktop

1 Accepted Solution

Accepted Solutions

Re: how to make sure dorbox link whether it can download

Здравко
Super Collaborator | Level 20

@alicera wrote:

...

```

if wget -q --method=HEAD ftp://ftp.somewhere.com/bigfile.gz;
then
echo "This page exists."
else
echo "This page does not exist."
fi

```

...


Hm... 🤔 @alicera, let's change it little bit:

if wget -q --method=HEAD --max-redirect 0  https://www.dropbox.com/s/abcdefg/123?dl=0 ;
then
echo "This page does not exist."
else
echo "This page exists."
fi

Is it working now? 😜

View solution in original post

9 Replies 9

Re: how to make sure dorbox link whether it can download

Jay
Dropboxer

Hi @alicera, thanks for messaging the Community.

 

Could you clarify what you're trying to do?

 

There isn't a direct method to test if a shared link to a file exists or not, since it would still generate a message on the Dropbox site, saying there isn't a file there.

 

This will help me to assist further!


Jay
Community Moderator @ Dropbox
dropbox.com/support


Heart Did this post help you? If so, give it a Like below to let us know.
:arrows_counterclockwise: Need help with something else? Ask me a question!
:pushpin: Find Tips & Tricks Discover more ways to use Dropbox here!

Re: how to make sure dorbox link whether it can download

alicera
Explorer | Level 3

Assume these link are setting to share

correct drop box link:  https://www.dropbox.com/s/abcdefg/123?dl=0

incorrect drop box link:  https://www.dropbox.com/s/abcdefghiklnd/123?dl=0

where the incorrect drop box link is the two status to generate

1. mistake by myself.  I got the link wrong when typing.

2. I remove the file but link is hard code somewhere

So I wnat to write a code to check whether the link work or not

Do you know what I mean?

 

Re: how to make sure dorbox link whether it can download

Jay
Dropboxer

As far as I'm aware, it isn't possible to determine if a file exists at a specific link. Entering the incorrect link means it wouldn't be possible to locate the file.

 

If the file was deleted, the shared link would also be deleted, and can't be restored to the same link.


Jay
Community Moderator @ Dropbox
dropbox.com/support


Heart Did this post help you? If so, give it a Like below to let us know.
:arrows_counterclockwise: Need help with something else? Ask me a question!
:pushpin: Find Tips & Tricks Discover more ways to use Dropbox here!

Re: how to make sure dorbox link whether it can download

Rich
Super User II

@alicera wrote:

So I wnat to write a code to check whether the link work or not


The problem you're likely running into is that even when the file doesn't exist, the page still does, and that is what wget is checking for. You're not actually checking for the existence of a file; you're checking a specific page (the URL of the shared link), and that page will load even when the file doesn't exist, so wget reports that the page exists.

Re: how to make sure dorbox link whether it can download

alicera
Explorer | Level 3

I mean I upload a file and share it .

I will get a share link and I can download it with wget .

And I hard code the link to my program.

 

Someday, I delete the file on dropbox and forget to change the program share link code

So I want to add some code to check whether the link invalid or not 

 

Re: how to make sure dorbox link whether it can download

alicera
Explorer | Level 3

I try to give the error dropbox link format .

It can download a file (invalid file)

you can try it 

Re: how to make sure dorbox link whether it can download

Здравко
Super Collaborator | Level 20

@alicera wrote:

...

```

if wget -q --method=HEAD ftp://ftp.somewhere.com/bigfile.gz;
then
echo "This page exists."
else
echo "This page does not exist."
fi

```

...


Hm... 🤔 @alicera, let's change it little bit:

if wget -q --method=HEAD --max-redirect 0  https://www.dropbox.com/s/abcdefg/123?dl=0 ;
then
echo "This page does not exist."
else
echo "This page exists."
fi

Is it working now? 😜

Re: how to make sure dorbox link whether it can download

alicera
Explorer | Level 3

Thanks for your help.

 

Does it has the code for python with dropbox lib 

Re: how to make sure dorbox link whether it can download

Здравко
Super Collaborator | Level 20

@alicera, The questions you place here (including the last one) have their answers in other thread you asking for the same! Greg' proposal there is posted long before your last question. It's the same for all Dropbox supported SDKs (not just Python). There you can see too why/how my proposal works. 😉

Who's talking

Top contributors to this post

  • User avatar
    Здравко Super Collaborator | Level 20
  • User avatar
    alicera Explorer | Level 3
What do Dropbox user levels mean?
Need more support?