The filename directory name or volume label syntax is incorrect stackoverflow

Blog

  • #1

The file name, directory name or volume label syntax is incorrect.

How do I fix this??

Last edited by a moderator: Sep 24, 2019

Mar 13, 2011 10,957 13 51,965 1,365

  • #2

Normally, this only happens when you use extended characters in a name [anything outside a-z A-Z or 0-9].

It's likely that the source of the problem is an ini file redirecting to the wrong folder/volume/file. The solution is to find and edit it to the correct path.

Example of a file path:

c: programfiles[x86]/crysis/crysis.exe]

Last edited by a moderator: Sep 24, 2019

Mar 13, 2011 10,957 13 51,965 1,365

  • #2

Normally, this only happens when you use extended characters in a name [anything outside a-z A-Z or 0-9].

It's likely that the source of the problem is an ini file redirecting to the wrong folder/volume/file. The solution is to find and edit it to the correct path.

Example of a file path:

c: programfiles[x86]/crysis/crysis.exe]

Last edited by a moderator: Sep 24, 2019

Feb 17, 2014 36 0 4,540 4

  • #3

'the file name, directory name or volume lable syntax is ncorrect;

hexit is right^^^^

also take all spaces out of the folder names.. spaces are bad and ruin the system... ive been down that road!

  • #4

Just change folder's name and write in english.Im guessing that folder's name is written in unsupported language

Mar 13, 2011 10,957 13 51,965 1,365

  • #5

no mate thats not what the problem is, the files he wants to delete are using a none standard naming system outside the typical 0-1 a-z A-Z lettering conventions. back in the days of 8,3 naming system we used to use characters like !"£$ and so on as the first letter to hide files and folders from the directory search. which meant unless you knew exactly what the file was called you could never see it in the files and folders lists.
today it still shows up now and again. the files are easy enough to remove if you know what your looking for, but there still a pain when you come across them...

  • Advertising
  • Cookies Policies
  • Privacy
  • Term & Conditions
  • Topics

DISABLE ADBLOCK

ADBlock is blocking some content on the site

  •   java  -  io
  •  | 
  •  14-11-2019
  •  | 
  •  

 Checked

Question

I tried inputting quoted and unquoted filenames, but it still only processes up to the first space. Even when there are no spaces in the path, the file's not detected, but the path is correctly displayed. How to fix it?

Enter the filename: a b c java.io.FileNotFoundException: a [The system cannot find the file specified] Enter the filename: "a b c " java.io.FileNotFoundException: "a [The system cannot find the file specified]

Is this the best way to get file input? Also, should I add throws IOException, FileNotFoundException to main or use try{} instead?

System.out.print["Enter the filename: "]; Scanner stdin = new Scanner[[System.in]]; //Keyboard input String nextDataValue, data, popped="", tag="", fileName=stdin.next[]; FileInputStream fis = null; try { fis = new FileInputStream[fileName]; } catch [FileNotFoundException e] { e.printStackTrace[]; } InputStreamReader inStream = new InputStreamReader[fis]; BufferedReader in = new BufferedReader[inStream]; data=in.readLine[];

Solution

The scanner is pretty clearly giving you space-delimited tokens. From the Scanner JavaDocs:

A Scanner breaks its input into tokens using a delimiter pattern, which by default matches whitespace.

So there you have it. I hate to say it, but this is a case of RTFD.

Use a different delimiter, or use Scanner#nextLine[] instead of Scanner#next[].

Chủ Đề