I want to write the content of a string variable say $data
in to a file named data.xml the folder location will vary depends upon the content of $appId variable
like i want to write file in
files_dir/$appId/data.xml
moreover if that file already exists than i want to rewrite otherwise i want to create the folder and then create the file data.xml
Can u suggest some way to do so.