Flight in the creation of a new folder and file with a mistake The filename, directory name, or volume label syntax is incorrect
-
When a new folder and a new file is created, only the first folder is created, and the second is not, further, when the new file is created, the specimen will go out to try and catch.
String folName = "c:\\Patients\\" + fName.substring(0, fName.lastIndexOf("."))+"\\"; File folder = new File(folName);
if(!folder.exists())
{
folder.mkdirs();
}File file = new File(folder, fName);
if(!file.exists())
folder.createNewFile();
Exclusion
java.io.IOException: The filename, directory name, or volume label syntax is incorrect.
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(File.java:1012)
at server.TxtReadWriter.ReceiveFileFromClient(TxtReadWriter.java:84)
at server.TxtReadWriter.run(TxtReadWriter.java:46)Even though all manualas have to make at least the creation of all the files, from the first to the last. If anyone tells me what I'm really grateful for.
-
The whole point was that the folder had an unacceptable symbol.
'|'
♪