Using query strings to construct the local file name

Started by crocket, August 18, 2023, 09:25:03 PM

Previous topic - Next topic

crocket

I am trying to figure out how to add portions of the query string to the name of the file that is downloaded locally to my computer. I have added a list of URLs to my project and I am able to successfully download these files. The problem I have is that the files downloaded are named get_photo-1, get_photo-2, get_photo-3, etc...

I have tried a number of combinations in the General > Local Files section of the Project Properties, but either I am doing something wrong or I do not understand the purpose of this set of properties.

The Additional URLs that I have added are all unique and are all identical, except for the photo name. I am trying to include the unique .jpg name and the application_id in the name of each .jpg that is downloaded. This is an example of what the URLs look like..

https://test.site.com/api/v1/get_photo?filename=photo_f203144c-b817-4fb4-bd10-e0b1f97045ec.jpg&app_id=7840
https://test.site.com/api/v1/get_photo?filename=photo_8309bb32-1345-4181-9e71-87f40c381527.jpg&app_id=7840
https://test.site.com/api/v1/get_photo?filename=photo_4deda05d-56f2-4894-829c-7bb1e1ce3f6d.jpg&app_id=7900
https://test.site.com/api/v1/get_photo?filename=photo_2d57c78c-4ad5-455f-abbf-a4ba8a3cb3c2.jpg&app_id=7900

Can someone tell me what set of options must be selected to achieve this? 

Thanks!


Manuela

Do I understand correctly that you want to download files with a specific URL? Why not use a rule?
regex is your friend

^https://test\.site\.com/api/v1/get_photo\?filename= as expression, compare = entire URL

crocket

I am already providing WebCopy with a complete list of files to download, so I don't think I need a rule to download specific files. On my test site, I am able to get WebCopy to download these files from the list I provide to WebCopy. The problem is that the image files that are downloaded are name get_photo-1, get_photo-2, get_photo-3, and so on.

I am trying to figure out how to get WebCopy to give these images a specific name based on the images URL. I specifically need WebCopy to name the file using the image name and the app_id value that is in the URL.

I am not very picky on the exact format of the file name, but I do need the file to have key pieces of information in the name.
https://test.site.com/api/v1/get_photo?filename=photo_12345678-1234-5678-9876-abdefghijklm.jpg&app_id=98765
In the URL example above, I need at least this info contained somewhere in the file name
  • photo_12345678-1234-5678-9876-abdefghijklm.jpg
  • app_id=98765
 
Thanks!

Manuela

Use query string in local filenames should exactly do want you want, you said you have checked this out and it did not? I guess then this is a bug

crocket

That is what I am thinking as well.  Attached is a screenshot for the Local File properties for my project.

crocket

I was able to get WebCopy to save the files using the query string parameters. I created a new project and used the default items checked on the Local File property screen, along with enabling the "Use query string in local file names" option.

In the past, I tried numerous combinations of options on the Local File property section but nothing seemed to work. I'm not sure if I missed a specific combination of options or if the creation of a new project fixed the issue.

Anyway, attached is a screen of the Local Files property screen that worked for me if anyone else has problems with the query string naming option.

Thanks!