1

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

2 Answers 2

1

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
)
Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.