Are you using the Slide client API? If so, check out the javadoc for WebdavResource
http://jakarta.apache.org/slide/clientjavadoc/index.html
It would probably be good to get a WebDAV book too since the javadoc doesn't explain what MKCOL means... in my opinion the specs on webdav.org are too dry to read


From what I can tell WebdavResource mirrors the File class pretty well, so:

http://wiki.apache.org/jakarta-slide/CreateNewDirectoryAndFile

WebdavResource res = new WebdavResource(hrl);
boolean success=res.mkcolMethod("/slide/files/testDir");



Zoltan wrote:

Thank you for your prompt answer. I don't know if my question was clear
enough. What I am trying to do is to upload certain files (based on a given
criteria) to subfolder subF1; others to subfolder subF2 and so on. So I
need:
1) to check the existence of the subfolder (under slide/files)
2) if it does exist, just upload the file there
3) if it does not exist, create the subfolder and then upload the file
there.

What I don't know is: could the client programmatically (using the Webdav
API) create subfolders on the Slide server (under slide/files)? If yes, how?

Even when using the command line Webdav client I could not find a command
that creates subfolders on the Slide server.

Regards,
Zoltan

-----Original Message-----
From: Brian Lee [mailto:[EMAIL PROTECTED] Sent: Friday, February 18, 2005 3:54 PM
To: Slide Users Mailing List
Subject: Re: programatically create subfolders


If I understood what you're asking .... can't you just have another class / function check path found in the url request?

ie
1) extract the path from the url
2) check if the path exists in the file system
2) if the path doesn't currently exist, this class / function will create the path....


Just call this function before you call the putMethod function. I believe commons io has this function already made for you if you don't feel like doing it yourself.

Zoltan wrote:



Hello,



I have the following snippet of code:



          String url = "http://"+ serverName + ":" + slidePort +
"/slide/files/";

HttpURL hrl = new HttpURL(url);

          WebdavResource wdr = new WebdavResource(hrl);

          File fn = new File(fileName);

          String path = url + fn.getName();

          wdr.putMethod(path, fn);

          wdr.close();



This successfully uploads the given file to the Slide server (under
slide/files).

How should I modify the above code to be able to upload the file in a
subfolder of slide/files? (something like
slide/files/folderA/folderB/filename).




In other words: is there a way to programmatically create folders under
slide/files?



Thanks in advance for your response,

Zoltan








---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to