I am creating some files and file names are being fetched from database.
There is a file name called
CUA/ICOR Digital Collection.
But, because of forward slash, "CUA" is getting treated as directory.
I have found Forward slash in Java Regex
and I have tried:
String fileName = "CUA/ICOR Digital Collection";
fileName = fileName.replaceAll("/", "\\\\/"); // OP: CUA\/ICOR Digital Collection But No success
fileName = fileName.replaceAll("/", Matcher.quoteReplacement("\\/")); // OP: CUA\/ICOR Digital Collection But No success
fileName = fileName.replaceAll("/", Matcher.quoteReplacement("\\\\/")); // OP: CUA\\/ICOR Digital Collection But No success
File file = new File(exportPath, fileName + ".xls");
I am getting
File Not Found Exception At 'C:\export\CUA\ICOR Digital Collection.xls'
So, Now I doubt is it possible ?