File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes I/O and Streams and the fly likes Unable to Create Non-Read-Only Directories... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Unable to Create Non-Read-Only Directories..." Watch "Unable to Create Non-Read-Only Directories..." New topic
Author

Unable to Create Non-Read-Only Directories...

Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
Hi Everyone,

I am trying to create a directory using JAVA in which the code will copy some files into. But the problem is the directory that is created is always read only and so am always getting an error while copying..



Could you please tell me how to create a non Read Only directory. I am using Java 1.4.2!
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8908
    
    8

How are you creating the directories?
Does the directory get created?
Do the parent directories exist? Do you or the users the application run as have permission to write to them?
Is the same user creating the directories and trying to copy?

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
Here is the fragment of code....
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8908
    
    8

You didn't answer my questions, so I can't give you much more advice than this: use mkdirs()
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477
How are you creating the directories?

As you may have already noticed that i am using mkdir() method.
Does the directory get created?

Yes the directories are getting created.
Do the parent directories exist? Do you or the users the application run as have permission to write to them?

I am using windows. The parent directories are getting created when the application is run. But when i check for the properties of the folders in windows i see that they are read only. That's the problem...
Is the same user creating the directories and trying to copy?

I am user and i am running the code in eclipse. So do dont think the code should have any user related violation!

I tried to post this yesterday, but the javaranch's server was down!
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8908
    
    8

Somnath Mallick wrote:
I am using windows.


There's your problem. ALL directories in Windows are "read only". Funny thing is, you can create and write a file inside them.
Somnath Mallick
Ranch Hand

Joined: Mar 04, 2009
Posts: 477

Well that gets rid of the access problem then! Thanks everyone!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Unable to Create Non-Read-Only Directories...