i have written a shell script to upload all files with different names in the specific path from local to host, but i have facing some issue and the files are not getting uploaded
#!/bin/sh
for file in /main/folder1/path/*
do
curl -u Pass:"Uname" -T $file http://www.example.com/folder/$file
done
please help me to solve this.
i am getting the error as following
<html>
<head>
<title> 500 Internal Server Error </title>
</head>
<body>
<h1>
Internal Server Error
</h1>
</body>
</html>
currently i am having the script inside /main/folder_2
, if i change /main/folder_1/path/*
to ../folder_1/path/*
, i got the output, the files are moved as expected. but i want to run the script with the complete path specified.
Best Answer
I would change you script like so:
Note that the for-loop variable
file
is used withcurl
.Better way is to upload using
find + curl
(as was answered on SO):P.S. More info about
would be helpful.