Пример #1
0
int main (int ac, char* av[]){
  

  /******* Parsed value containers ****************/
  string dietConfig;
  string path;

  /********** EMF data ************/
  FMS_Data::RmFileOptions rmFileOptions;

  /**************** Describe options *************/
  boost::shared_ptr<Options> opt(makeRemoteCommandOpt(av[0],dietConfig,path));
  
  opt->add("isRecursive,r",
      "It specifies when the remove command is recursive (case of directory) or not.",
      CONFIG);
  
  bool isEmpty;
  GenericCli().processListOpt( opt, isEmpty,ac,av," path");
 
  // Parse the cli and setting the options found

  if(opt->count("isRecursive")){
    rmFileOptions.setIsRecursive(true);
  }

  FileActionFunc<REMOVEFILE,FMS_Data::RmFileOptions> apiFunc(path,rmFileOptions);
  return GenericCli().run(apiFunc, dietConfig, ac, av);

}
Пример #2
0
void
FileTransferServer::move(const TransferExec& transferExec,
                         const std::string& trCmd) {
  // perform the copy
  copy(transferExec,trCmd);
  int lastExecStatus=transferExec.getLastExecStatus();

  if (lastExecStatus == 0) {

    // remove the source file
    FileFactory ff;
    ff.setSSHServer(transferExec.getSrcMachineName());
    boost::scoped_ptr<File> file (ff.getFileServer( transferExec.getSessionServer(),transferExec.getSrcPath(),
                                                    transferExec.getSrcUser(),transferExec.getSrcUserKey() ) ) ;
    try {
      FMS_Data::RmFileOptions options;
      options.setIsRecursive("true");
      file->rm(options);
    } catch(VishnuException& err) {
      updateStatus(vishnu::TRANSFER_FAILED,transferExec.getTransferId(),err.what());
      transferExec.setLastExecStatus(1);
    }
  }
}