digitalWestie
digitalWestie

Reputation: 2797

Why can't a number character cannot be used as a directory name? (Java)

I have a folder with the name '4' in a zip file containing some image files. When I check the contents of the zip, isDirectory does not register the '4' folder as a directory.

When 4 is renamed to 'tour_4' isDirectory returns true! Does anyone know this is?

Can a directory name be a single number character?


EDIT - OK I've discovered it's nothing to do with the name. It maybe something to do with file system. What I'm trying to do is download and unzip a file from the web. When I create the zip locally (windows file system) it works fine - when it's downloaded from the web (linux file system) it doesn't find the directory name.

Upvotes: 2

Views: 163

Answers (1)

GolezTrol
GolezTrol

Reputation: 116110

Do you use '4' to refer to the directory name, or 4 (without the quotes)? You should use '4', because even though the name looks like a number, it is still a string.

Upvotes: 3

Related Questions