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
doneplease 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.
1 Answer
I would change you script like so:
#!/bin/sh
for file in /folder/path/*
do curl -u username:password -T ${file}
doneNote that the for-loop variable file is used with curl.
Better way is to upload using find + curl (as was answered on SO):
find /folder/path/ -name '*' -type f -exec curl -u USERNAME:PASSWORD -T {} \;P.S. More info about
some issue is stopping the files getting uploaded
would be helpful.
2