This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Create a directory in a mapped location  RSS feed

 
Suma Rangaraj
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have mapped a shared directory on a remote machine to my machine as - Z:\TestMkDir.

Now I want to create a directory here using the following code but it cannot.

String path="Z:\TestMkDir";
File dir = new File(path);
boolean isCreateSuccess = dir.mkdirs();

Is it possible at all to create a dir on a mapped directory?
Thanks!
 
Wirianto Djunaidi
Ranch Hand
Posts: 210
Ruby Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suma,

If you already has the mapping of Z:\TestMkDir, then it already exist.
Of course you can't make a new directory with the same name.

If you meant that you mapped your remote drive to Z:\ and try to create TestMkDir directory there, then it depend on what error message that you get. Can you give more detail?
 
Suma Rangaraj
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi - Thanks for your reply. It doesn't throw any error but it just returns false.

BTW I am just trying to create a directory that doesn't exist. I checked it.
 
Wirianto Djunaidi
Ranch Hand
Posts: 210
Ruby Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you try setting path to "Z:\\TestDir" or "Z:/TestDir"?
 
Suma Rangaraj
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. I tried ..I also gave full control to users for Z:\TestMkDir
no luck :-<
 
Suma Rangaraj
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I also tried complete name
\\<server>\<test\TestMkDir

no luck with this too...
 
Vilmantas Baranauskas
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this code:
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!