This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Servlets and the fly likes mkdir in java for Unix Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "mkdir in java for Unix" Watch "mkdir in java for Unix" New topic

mkdir in java for Unix

Anthony Smith
Ranch Hand

Joined: Sep 10, 2001
Posts: 285
I use the mkdir in my servlet to create a certain directory if it does not exists. Well here's my problemo. It works fine on Windows but craps out on Unix. I see the folder there I create but later on in my code I try and write a file to the folder and it bombs put saying that it does not exist, when I am looking at it. However if I try and go to the server and cd to the folder it says does not exists but it is there and I do a ls -l and it says that the folder is a folder. However if I try and do a mkdir with the same name it makes another dir with the same name in the same place. I do a ls -l and everything is identical except the date.
Please help!
Peter den Haan
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
I don't believe you The folder names are not the same.
  • Unix is case sensitive, where Windows isn't. Do you have case differences?
  • Unix allows virtually any character to be part of a directory (or file) name, including spaces and many unprintable characters. Are you sure you don't have trailing spaces or embedded unprintables in one of them?
  • If necessary, use "ls -l|od -a" to generate a dump of the ls output that will show you all unprintables and spaces in the filenames.
  • Hope this helps,
    - Peter
    [ May 18, 2002: Message edited by: Peter den Haan ]
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    subject: mkdir in java for Unix
    It's not a secret anymore!