Esempio n. 1
0
 def rename_collection(self, irods_collection, new_name):
     """Rename a collection from irods
     irods_collection : path (str)"""
     dataObjRenameInp = irods.dataObjCopyInp_t()
     srcDataObj = dataObjRenameInp.srcDataObjInp
     dstDataObj = dataObjRenameInp.destDataObjInp
     srcDataObj.oprType = irods.RENAME_COLL
     dstDataObj.oprType = irods.RENAME_COLL
     srcDataObj.objPath = irods_collection
     dstDataObj.objPath = new_name
     return irods.rcDataObjRename(self.conn, dataObjRenameInp)
Esempio n. 2
0
 def move_collection(self, path, new_path):
     """Move a collection in irods
     return True if the dest collection is already present"""
     dataObjRenameInp = irods.dataObjCopyInp_t()
     srcDataObj = dataObjRenameInp.srcDataObjInp
     dstDataObj = dataObjRenameInp.destDataObjInp
     srcDataObj.oprType = irods.RENAME_COLL
     dstDataObj.oprType = irods.RENAME_COLL
     srcDataObj.objPath = path
     dstDataObj.objPath = new_path
     status = irods.rcDataObjRename(self.conn, dataObjRenameInp)
     return status
Esempio n. 3
0
 def rename_file(self, file_info, new_name):
     """Rename a file from irods
     file_info : (collection, file, resource)
     new_name : str"""
     (collection, irods_file, _) = file_info
     dataObjRenameInp = irods.dataObjCopyInp_t()
     srcDataObj = dataObjRenameInp.srcDataObjInp
     dstDataObj = dataObjRenameInp.destDataObjInp
     srcDataObj.oprType = irods.RENAME_DATA_OBJ
     dstDataObj.oprType = irods.RENAME_DATA_OBJ
     srcDataObj.objPath = collection + '/' + irods_file
     dstDataObj.objPath = collection + '/' + new_name
     return irods.rcDataObjRename(self.conn, dataObjRenameInp)
Esempio n. 4
0
 def move_file(self, path, new_path, overwrite=False):
     """Move a file in irods
     return True if the file is already present"""
     if overwrite:
         self.delete_file(new_path)
     dataObjRenameInp = irods.dataObjCopyInp_t()
     srcDataObj = dataObjRenameInp.srcDataObjInp
     dstDataObj = dataObjRenameInp.destDataObjInp
     srcDataObj.oprType = irods.RENAME_DATA_OBJ
     dstDataObj.oprType = irods.RENAME_DATA_OBJ
     srcDataObj.objPath = path
     dstDataObj.objPath = new_path
     status = irods.rcDataObjRename(self.conn, dataObjRenameInp)
     return status == irods.CAT_NAME_EXISTS_AS_DATAOBJ