For example you have a command where the second argument is a directory plus file name:
String fileName = "createF dir/text.txt";
String textToFile="apples, oranges";
How can I create "dir/text.txt", a folder called dir, a txtfile and write the contents of textToFile to it?
The issue is it is a command. And it is file name can be changed to another file name. I can't use FileWriter
method. It gives no directory error.