Reputation: 244
I have to upload files using curl. I can upload single or multiple file using file name, but i want to uplaod all files in a filder with *.csv mask. How i can upload it. as i read on one of the post saying, curl doesn't support wildcards.
ForFiles /m *.csv /c "cmd /c curl.exe -u "username:passowrd" -ssl --cacert "cacert.pem" -F "[email protected]" -F "profileKey=001" https://somewebsite.com/api/api-upload.php >> output.txt
If i can use same ForFiles with following, I can get file name in @file
ForFiles /m *.csv /c "cmd /c echo @file
I tried combining, it deson't work, plz help
ForFiles /m *.csv /c "cmd /c curl.exe -u "username:passowrd" -ssl --cacert "cacert.pem" -F "pfile=@file" -F "profileKey=001" https://somewebsite.com/api/api-upload.php >> output.txt
Upvotes: 1
Views: 2690
Reputation: 1
see here, maybe will help, https://support.precisionlender.com/hc/en-us/articles/206935207-Using-a-batch-file-to-automate-uploads-with-cURL
He is using '-H' for header ,like if you need add cookies.. and '-F' for the file specification.
Upvotes: 0
Reputation: 244
I got answer:
for %%f in (*.csv) do (
curl.exe -u "username:password" -ssl --cacert "cacert.pem" -F "pfile=@%%f" -F "profileKey=001" https://somewebsite.com/api/api-upload.php >> output.txt
)
Upvotes: 1