Error in writing file in a directory


Please read tips for efficient and successful posting and posting code

ROOT Version: 16.06.00
Platform: Linux Ubuntu
Compiler:

Hey Rooters,
I have a program where I want to read files from a directory and then save the output in another directory, I am able to read but when the program ends it shows an error in writing to that folder. Every response will be greatly appreciated. My code is as below:

TString fFileName = “/lustre/cbm/prod/gen/urqmd/auau/25gev/centr/urqmd.auau.2
5gev.centr.00001.root”;
TString fOutFile ="/lustre/cbm/users/UrQMD/output_urqmd25centrCut100.root";

TFile*f=new TFile(fOutFile,“RECREATE”);
homega->Write();
hxi->Write();
hlambda->Write();

Error:

SysError in TFile::TFile: file /lustre/cbm/users/UrQMD/output_urqmd25centrCut100.root can not be opened (No such file or directory)
Error in TROOT::WriteTObject: The current directory (Rint) is not associated with a file. The object (homega) has not been written.
Error in TROOT::WriteTObject: The current directory (Rint) is not associated with a file. The object (hxi) has not been written.
Error in TROOT::WriteTObject: The current directory (Rint) is not associated with a file. The object (hlambda) has not been written.

ThankYou,
Towseef Rehman

Please check that you have write access to the directory

Thank you@ linev, how can I check that?

Just try to copy any small file into this directory.
Or do ls to see attributes of directory “UrQMD”:

ls -l /lustre/cbm/users/