03-12-2008
final result
Here is what I ended up with if this helps anybody. I modified cadaver to do what I needed. Source is available if requested. This is my .bash_login for cygwin.
#########################################################
#!/bin/sh
#list directories and divide into names and paths
cd /tmp/upload
DIR="."
function list_files()
{
if !(test -d "$1")
then echo $1; return;
fi
cd "$1"
for i in *
do
if test -d "$i" #if dictionary
then
list_files "$i" #recursively list files
cd ..
else
echo "$i"| 'pwd' >> /tmp/dir
echo "/""$i""\"" >> /tmp/files
fi
done
}
if [ $# -eq 0 ]
then list_files .
fi
for i in $*
do
DIR="$1"
list_files "$DIR"
shift 1 #To read next directory/file name
done
# Format the file names and paths for the webdav
cat /tmp/dir | sed -e 's|/tmp/upload/|/|' -e 's| |%20|'> /tmp/Short_listing;
paste -d '' /tmp/dir /tmp/files > /tmp/full_files;
cat /tmp/full_files | sed -e 's| |\\\\ |g' -e 's|/tmp/upload/|/tmp/Upload/|'> /tmp/full_files_spaced;
cat /tmp/files | sed -e 's| |\\\\ |g' -e 's|/||' > /tmp/short_files_spaced;
#start building the cadaver command
cat /tmp/Short_listing |while read line; do echo cadaver -t \""http://10.1.1.142:80/ktwebdav/ktwebdav.php""${line}"\" -U "uname" -P "pass" -D \";done > /tmp/d_commands1
cat /tmp/Short_listing |while read line; do echo cadaver -t \""http://10.1.1.142:80/ktwebdav/ktwebdav.php""${line}"\" -U "uname" -P "pass" -A \";done > /tmp/a_commands1
#delete commands
paste -d '' /tmp/d_commands1 /tmp/short_files_spaced > /tmp/d_commands2
sed '/\*\"/d' /tmp/d_commands2 > /tmp/d_commands3.sh
chmod 775 /tmp/d_commands3.sh
/tmp/d_commands3.sh > /tmp/log/hist.txt
#add commands
paste -d '' /tmp/a_commands1 /tmp/full_files_spaced > /tmp/a_commands2
sed '/\*\"/d' /tmp/a_commands2 > /tmp/a_commands3.sh
chmod 775 /tmp/a_commands3.sh
/tmp/a_commands3.sh >> /tmp/log/hist.txt
# time to clean up
rm /tmp/*
rm /tmp/upload/*
rm /tmp/upload/*/*
rm /tmp/upload/*/*/*
rm /tmp/upload/*/*/*/*
# log what was done
date >> /tmp/log/failed.log
date >> /tmp/log/Conflict.log
date >> /tmp/log/succeeded.log
cat /tmp/log/hist.txt | grep failed >> /tmp/log/failed.log
cat /tmp/log/hist.txt | grep Conflict >> /tmp/log/Conflict.log
cat /tmp/log/hist.txt | grep succeeded >> /tmp/log/succeeded.log
exit
This User Gave Thanks to brazen1445 For This Post:
7 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hey,
I have a WebDav directory mounted and everything seems fine except for one thing. All file/directory names appear in all UPPERCASE, when in actual fact they are lowercase on the remote machine.
For example:
foo/bar/baz.html on the remote host, appears on my local machine as... (0 Replies)
Discussion started by: MrMoney
0 Replies
2. Shell Programming and Scripting
Hi all
i have a such question this is my shell script my script must upload file to webdav server
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
#!/bin/sh
###... (1 Reply)
Discussion started by: knut
1 Replies
3. OS X (Apple)
Hello!
I need some advice about using WebDav in Mac OS 10.5
My problem is that I mount a WebDav folder in the hard drive pointing to a webdav directory service running under apache (it's Alfresco, if you know it) but the permissions of this directory, when mounted, are only for the user who... (0 Replies)
Discussion started by: osksp
0 Replies
4. Debian
hi all,
i have configured Apache with WEBDAV & my aim is sharing outlook calendars because we don't use M$ ExChange.
From outlook i did a simple test & am able to share a calendar.
I want to create share for each user & then authenticate against LDAP before they can publish their... (0 Replies)
Discussion started by: coolatt
0 Replies
5. Linux
I configured a WebDAV server using Apache. Here is my configuration:
DAVLockDB /var/www/DAVLock.db
<Location /majid>
AllowOverride None
Options +Indexes
DAV On
AuthUserFile
/var/www/users.db
AuthName Authentication
AuthType Basic
<Limit... (1 Reply)
Discussion started by: majid.merkava
1 Replies
6. Shell Programming and Scripting
Hi,
I am required to automate file transfer to a Sharepoint Collection, I have failed in mounting the webdav as a file system using davfs2 so I am investigating Curl and Cadaver.
Cadaver is probably the easiest solution, I can successfully connect and transfer files. However can anyone advise... (2 Replies)
Discussion started by: mcclunyboy
2 Replies
7. Web Development
Hi All,
I am using a webdav server
host name : abc.xyz.com.ak
username : user123
password : password123
port : 80
I need to send files stored in my windows system to the server, any idea how to do it.
I dont know how to create a url in linux for webdav server using details. (2 Replies)
Discussion started by: prakhar_dubey
2 Replies
LEARN ABOUT MOJAVE
curlopt_resume_from_large
CURLOPT_RESUME_FROM_LARGE(3) curl_easy_setopt options CURLOPT_RESUME_FROM_LARGE(3)
NAME
CURLOPT_RESUME_FROM_LARGE - set a point to resume transfer from
SYNOPSIS
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_RESUME_FROM_LARGE,
curl_off_t from);
DESCRIPTION
Pass a curl_off_t as parameter. It contains the offset in number of bytes that you want the transfer to start from. Set this option to 0 to
make the transfer start from the beginning (effectively disabling resume). For FTP, set this option to -1 to make the transfer start from
the end of the target file (useful to continue an interrupted upload).
When doing uploads with FTP, the resume position is where in the local/source file libcurl should try to resume the upload from and it will
then append the source file to the remote target file.
DEFAULT
0, not used
PROTOCOLS
HTTP, FTP, SFTP, FILE
EXAMPLE
CURL *curl = curl_easy_init();
if(curl) {
curl_off_t resume_position = GET_IT_SOMEHOW;
curl_off_t file_size = GET_IT_SOMEHOW_AS_WELL;
curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com");
/* resuming upload at this position, possibly beyond 2GB */
curl_easy_setopt(curl, CURLOPT_RESUME_FROM_LARGE, resume_position);
/* ask for upload */
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
/* set total data amount to expect */
curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, file_size);
/* Perform the request */
curl_easy_perform(curl);
}
AVAILABILITY
Added in 7.11.0
RETURN VALUE
Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
SEE ALSO
CURLOPT_RESUME_FROM(3), CURLOPT_RANGE(3), CURLOPT_INFILESIZE_LARGE(3),
libcurl 7.54.0 February 03, 2016 CURLOPT_RESUME_FROM_LARGE(3)