I have a large dataset I have to download every day and I’m trying to pull it and save it as a .csv with a date stamp using cURL.
Here is my file:
echo off
set day=%date:~7,2%
set mon=%date:~4,2%
set year=%date:~10,4%
set today=%year%%mon%%day%
curl --output "\ftpftpdai540test-%%today%%.csv" -L -k "https://home-c29.incontact.com/ReportService/DataDownloadHandler.ashx?CDST=o5qyGKBx1nP96CPUcQUwQ180mgTS%2fEQbIkeJv3vjrgVj1GRrvY%2f1sEd%2bus73FeHqtE1T3iQUln9jYrxYeSQGRFTRepFNBZ3Z73bxGxgBXLAocXQYs2bZFPK06q4WF2AnucBs0u9pssKJuTg%2fEvkgoZGKsFcUkHN3sZhY7cx2ZAVNHAndCD0qQpVBNQDK0RVahlbsk0UBT3LRKIDftYM8CvmIdLVvDxQ60FN%2bh%2fb&PresetDate=2&Format=CSV&IncludeHeaders=True&AppendDate=True"
(for security, I’ve changed the URL a bit)
When I run just the cURL command from the command line (without the %today% variable), it runs fine. When I run it from the .bat file with the date appended to the file name, it returns this:
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="/ReportService/Error_504.aspx?aspxerrorpath=/ReportService/DataDownloadHandler.ashx">here</a>.</h2>
</body></html>
I’d be very grateful if anyone could help me get this to work
Andy Rogers is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.