IWFile.move()

I am unable to get the IWFile.move() method to resolve the destination directory. Every incarnation I try always results in a com.interwoven.api.filesys.IWPath$IllegalException being thrown. For example, I'm trying to move a directory from one workarea inside another directory:

String sWorkareaSourcePath = "/TESTSTORE/main/Branch/WORKAREA/myworkarea/moveme";
String sWorkareaDestinationPath = "/TESTSTORE/main/Branch/WORKAREA/myworkarea/dir/moveme";

IWDir iwSourceDir = (IWDir)IWPathNamedObject.lookupByPath(m_iwFileSysService, sWorkareaSourcePath);
if (iwSourceDir != null) {
IWDir iwDestinationDir = (IWDir)iwSourceDir.move(m_iwFileSysService, sWorkareaDestinationPath, false);
}

com.interwoven.api.filesys.IWPath$IllegalException: Illegal path: "/TESTSTORE/main/Branch/WORKAREA/myworkarea/dir".
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
at com.interwoven.api.filesys.IWFileRemoterImpl_Stub.move(Unknown Source)
at com.interwoven.api.filesys.IWFile.move(IWFile.java:462)
...

This is Teamsite 5.5.2 on a Solaris system. I've tried prefixing the destination directory with "/iwmnt", and leaving off "/moveme" from the destination path. I've tried moving it to "/tmp" and the illegal path is reported as "/". I've tried moving it to "/tmp/" and the illegal path is reported as "/tmp".

Any suggestions would be appreciated.

Comments

  • Take a look at the JavaDocs for this - I don't believe this is supported (a little bit of emphasis added).


    IWDir inherits from IWFile
    public IWFile move(...)
      ...
      If this file is a directory, then this function's utility is limited to renaming the directory. This means that the target path's parent must match this directory's parent's path.


    In order to do what you want - you'd have to create the new directory, iterate through the old directory moving individual files (and recurse through this process for any sub-directories), and then ultimately delete the original source directory.

    Kind of a pain - but do-able...


    --fish
    (Interwoven, Curriculum Development)
  • My version of the javadocs didn't have this comment and must be old. It certainly explains the problem. Too bad because the GUI's File > Move option has exactly the functionality I want. Thanks for your help.
TeamSite Developer Resources

  • Docker Automation

  • LiveSite Content Services (LSCS) REST API

  • Single Page Application (SPA) Modules

  • TeamSite Add-ons

If you are interested in gaining full access to the content, you can register for a My Support account here.
image
OpenText CE Products
TeamSite
APIs