cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Whether you are transferring a single drive, a team or an entire organization, Movebot's cloud migration tool has been built to make your Dropbox migration simple - learn all about it here.

Dropbox files & folders

Get in sync with the Dropbox Community. Our members can answer all your questions on Dropbox files and folders. Join a discussion or start your own today.

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

referencing a file by name inside a shared folder

referencing a file by name inside a shared folder

powellj3
Explorer | Level 4

Hi,

    I have a system that picks up a named file in a public DropBox share once a week.  The file name will always be the same and the shared folder will always be the same.  But the file is deleted and replaced with a new one every week. It happens to be a weekly MP3 with that week's message in it.

 

   Because I replace the file once a week, it is a new file.  If I create a pulic share link for the file, I can access it.  But the moment I delete and replace it, the link ceases to work and I need to create a completely different one.  I then have to rewrite my code that references it. Now the Folder always remains and I can create a public share of that and that will remain a constant.  

 

  What I want to do is to create a link to the named file within the shared link.  Something along the lines

of.. https://www.dropbox.com/sh/bmpu81hwuj9ofb0/XXC1Dlzh5hLR4rIt1XRD7W60a/PublicMessage.mp3?dl=0&raw=1&t=.mp3 

except that doesn't work.

 

Any ideas please?

 

9 Replies 9

Re: referencing a file by name inside a shared folder

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

@powellj3 wrote:
...  If I create a pulic share link for the file, I can access it.  But the moment I delete and replace it, the link ceases to work and I need to create a completely different one.  ...

Hi @powellj3,

The link isn't stick to file name, but to file id! That's why when delete particular file, created link is going point to nowhere and the new file with the same name needs different link. For a possible workaround take a look here.

Hope this helps.

Re: referencing a file by name inside a shared folder

powellj3
Explorer | Level 4

Thanks.

 

   I knew that the link was a pointer to the file, independent of the file name and that is why it breaks if the file is deleted and recreated. I don't properly follow your explanation in the link, but assume it tries to update the file contents without the delete/create cycle.  Not sure how I can do that in the circumstances I have

 

  That is why I am using the link to the parent folder that contains the file and trying to refer to the file by name within the object that is the containing folder.  

  Oddly Google Drive, OneDrive and BT Cloud all use these links that have nothing to do with the file name.  

Re: referencing a file by name inside a shared folder

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

Yes, the link to the containing folder doesn't change - the folder is the same. Unfortunately the link pointed to the contained file in pointed folder (if the file gets recreated) still chages and there isn't a way to automaticaly retrive a file link when refering from a contained folder link. If you refer to a file by hand, using a folder link should work. Otherwise you have to avoid file recreation, as mentioned in the place I refer to in my previous post.

Hope this adds some clarity.

Re: referencing a file by name inside a shared folder

Rich
Super User II

@powellj3 wrote:

What I want to do is to create a link to the named file within the shared link.


Use &preview=filename.ext to link directly to a file within the shared link.

 

A shared link to a folder:

The name of a file within that folder:

  • file_example_MP3_1MG.mp3

The direct link to that file within the folder:

Re: referencing a file by name inside a shared folder

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

@Rich wrote:
...

The direct link to that file within the folder:


The full statement was:


@powellj3 wrote:

...

  What I want to do is to create a link to the named file within the shared link.  Something along the lines

of.. https://www.dropbox.com/sh/bmpu81hwuj9ofb0/XXC1Dlzh5hLR4rIt1XRD7W60a/PublicMessage.mp3?dl=0&raw=1&t=.mp3 

...

@Rich, Is it possible raw access, as stated, or only preview, as in your example? 🤔

Re: referencing a file by name inside a shared folder

Rich
Super User II

@Rich, Is it possible raw access, as stated, or only preview, as in your example? 🤔

I don't believe so. Even if you replace ?dl with ?raw, the preview page will load. I don't know of any other parameter you can specify other than preview.

Re: referencing a file by name inside a shared folder

powellj3
Explorer | Level 4

Thanks.

 

   I'll try that.  
 
   To give a bit more background, so you know why I am being so specific about my requirement...  During the self isolation in the Covid crisis, I am using the Telephony application Twilio to play out a weekly church service when someone dials a number.  Twilio uses code that is not dissimilar to VB in syntax and needs to reference the file as a URN.  Of course it works with the reference to the link (using the RAW parameter).  But every week I have to dive in and edit the code with the new link.  My hope in using the link to point to the parent folder and reference the file within it by name is that all I need to do is swap out the files and leave the code alone.  Actually, it won't even be me doing the swapping of the files.  The guy who preps the sound file from the YouTube video of the service would do that.  The dial in number would be for old folk who don't have internet to listen to the service.

 

  Given that, if the preview syntax only takes me to a page from where the file is hosted, it probably won't work in the circumstance I describe.  But I'll have a play

 

thanks

Re: referencing a file by name inside a shared folder

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

Hi @powellj3,

In such a case the proposed by @Rich won't work for your, unfortunately. As I mentioned before, currently files in a directory' link could be accessed reliably only by hand, which isn't your case. The easiest way is writing a script which take care to make file update (either locally or on Dropbox server) with just pointing the downloaded file as a argument. Another alternative could be (as you have a web service for call response) dynamic creation of a file link to the target file (if missing yet, or changed as a result of update) and use the result instead, not hardcoded link. 😉😇

Hope this gives right direction.

Re: referencing a file by name inside a shared folder

powellj3
Explorer | Level 4

Thanks.

 

i can see how modifying the file without the delete/recreate cycle will preserve the file ID.  I'm using a Mac and 20 odd years ago I used to support Unix boxes.  I might try and dust off my bash shell scripting.  Not a bad use of time given the current lock down in the UK.

Who's talking

Top contributors to this post

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