Sponsored Content
Top Forums Shell Programming and Scripting Please help with Webdav transfer script Post 302173702 by brazen1445 on Friday 7th of March 2008 02:38:15 PM
Old 03-07-2008
Please help with Webdav transfer script

I need help on a script that syncs a directory with a webdav directory.
For example I have the folders:
./upload/
./upload/client
./upload/client/department
./upload/client2
./upload/client2/department

each of these folders contain docs that need to goto the webdav.
also the client names change frequently so I realy would not want to hard code them in.

Here is my non working script w/ the fat cutout.

**********************************************************************************************
# I create a full listing of file names
cd /tmp/upload/
find "`pwd`" -name "*.*" > /tmp/Full_listing.txt;

#I cut down the file names and turn the spaces into %20 for the webdav
cat /tmp/Full_listing.txt | sed -e 's|/tmp/upload/|/|' -e 's| |%20|'> /tmp/Short_listing.txt;

# here is where I tranfer the files
cat /tmp/Short_listing.txt |while read line; do cadaver -t \""http://10.1.1.142:80/ktwebdav/ktwebdav.php""${line}"\" -U "username" -P "password" -S \"/tmp/upload"${line}"\";done

#here is where I delete the temp files
cat /tmp/Full_listing.txt |while read line; do rm \""${line}"\";done

**********************************************************************************************

the problem is cadaver is exec like this:
cadaver -t "http://10.1.1.142:80/ktwebdav/ktwebdav.php/client/department/doc.txt" -U "username" -P "password" -S "/tmp/upload/client/department/doc.txt"

When it should be this:
cadaver -t "http://10.1.1.142:80/ktwebdav/ktwebdav.php/client/department/" -U "username" -P "password" -S "/tmp/upload/client/department/doc.txt"

How do I cutout the documents name?
I have been working on this for a few days and have been unable to find a solution.

Thanks for reading my way to long post.
 

7 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

WebDav/davfs mounted file & directory names in all UPPERCASE

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

upload file to webdav server

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)

Permissions trouble with WebDav

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

webdav share per user ldap authentication

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

Could not open the lock database - Apache WebDAV setup

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

Webdav automation

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

Sending file to WebDav Server

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
CURLOPT_UPLOAD(3)					     curl_easy_setopt options						 CURLOPT_UPLOAD(3)

NAME
CURLOPT_UPLOAD - enable data upload SYNOPSIS
#include <curl/curl.h> CURLcode curl_easy_setopt(CURL *handle, CURLOPT_UPLOAD, long upload); DESCRIPTION
The long parameter upload set to 1 tells the library to prepare for and perform an upload. The CURLOPT_READDATA(3) and CURLOPT_INFILE- SIZE(3) or CURLOPT_INFILESIZE_LARGE(3) options are also interesting for uploads. If the protocol is HTTP, uploading means using the PUT request unless you tell libcurl otherwise. Using PUT with HTTP 1.1 implies the use of a "Expect: 100-continue" header. You can disable this header with CURLOPT_HTTPHEADER(3) as usual. If you use PUT to a HTTP 1.1 server, you can upload data without knowing the size before starting the transfer if you use chunked encoding. You enable this by adding a header like "Transfer-Encoding: chunked" with CURLOPT_HTTPHEADER(3). With HTTP 1.0 or without chunked transfer, you must specify the size. DEFAULT
0, default is download PROTOCOLS
Most EXAMPLE
CURL *curl = curl_easy_init(); if(curl) { /* we want to use our own read function */ curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); /* enable uploading */ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); /* specify target */ curl_easy_setopt(curl, CURLOPT_URL, "ftp://example.com/dir/to/newfile"); /* now specify which pointer to pass to our callback */ curl_easy_setopt(curl, CURLOPT_READDATA, hd_src); /* Set the size of the file to upload */ curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)fsize); /* Now run off and do what you've been told! */ curl_easy_perform(curl); } AVAILABILITY
Always RETURN VALUE
Returns CURLE_OK SEE ALSO
CURLOPT_PUT(3), CURLOPT_READFUNCTION(3), CURLOPT_INFILESIZE_LARGE(3), libcurl 7.54.0 February 03, 2016 CURLOPT_UPLOAD(3)
All times are GMT -4. The time now is 09:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy