Check if file exists before uploading

Nextcloud version : 13.05.2
Operating system and version : Ubuntu 18.04
Apache or nginx version: Apache 2.4.29
PHP version: PJP 7.2

The issue you are facing: I’m using the next command to upload files to my nextcloud:

curl --user myuser:mypass -X PUT nextcloudUrl/myFile --data-binary @my/path/myFile"

This is working ok but I need to check if the file exists before uploading it as I don’t want to overwrite it. Is there any parameter in the curl command to avoid the overwrite (if the file already exists I don’t want to upload a new one at all)?

I won’t put any log as this question doesn’t really need them, but if you ask for more info I’ll be happy to add it.

Thanks

2 Likes