Setup
I have a simple 1 line bash shell script. Its purpose, is to find all the files in a specific dir. Execute a curl POST of each file.. then move the files to a "old" dir.
Current attempt
Below is the find command I'm using.. I'm going to put it on multiple lines for easier reading, but it is all the same line in my script
sudo find . -type f
-exec curl -vX POST -H "Content-Type: application/json"
-H "Cache-Control: no-cache" -d @{} -u username:password
"http://192.168.105.10/homeaccess/services/aCStats/uploadData?username=vangeeij&filename=$(basename {})" \;
-exec sudo mv {} /home/vangeeij/acserver/resultsOld \;
Problem
Every part of the command works as desired except one part:
&filename=$(basename {})
I have tried every way I can think of to get the {}
output from the find command to be placed directly after the equals sign and NOT have the leading ./
in front of the file name.
Earlier in the command -d @{}
I need the ./
But here I don't
Previously Tried and failed
filename=$(basename {})
filename=$('echo {} | sed "s|^\./||"')
honestly the list goes on and on...
Question
In the exact usage above, how can I append the file name, minus the leading ./
directly after the filename=
in the URL