Home
TeamSite
Rename Directory using OpenAPI
sunil_j
Hi,
I want to rename a directory located in a workarea with a new name. Is it possible to by using OpenAPI ?
I have created the directory using the following code :
IWDir sampleDir = dir.createChildDir(fileSysService,strSectionName,userGroup,null,"Sample code created directory");
I want to rename this directory with some new Name.
Kindly let me know if its possible.
Regards
Sunil
Find more posts tagged with
Comments
Migrateduser
You might want to try using IWFile.move() instead since createChildDir() is normally used to create new directories:
move
public IWFile move(IWFileSysService service,
java.lang.String newPath,
boolean copyLock)
throws IWServiceManagedObject.AlreadyExistsException,
java.rmi.RemoteException
Move this file to the specified path. If this file is a simple file, then:
If the target path is a directory, this file is moved into the target directory.
If the target path is a directory containing a file/directory with the same name as this file, throw AlreadyExistsException.
If the target path is a simple file, the simple file at the target path is replaced with the contents of this file.
If this file is equal to the target path, then do nothing and return this IWFile object.
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.
This file must not be a hole nor symlink.
Parameters:
service - The file system service.
newPath - The path.
copyLock - Whether to copy the file's lock, if the file has a lock and the old file at the new path does not.
Returns:
The resulting file.