• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

help needed with creating folder

 
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I need help with creation of folder at specific location.



I need to create folder inside path represented by String folderPath variable.
This folder should be of the name represented by String fileName variable.

How can I create folder at the specific path by giving the path and foldername as parameters?

Please advice

Thanks
 
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about this

Just make a file with your pathname and fileName. It apears to me that all you have to do is call:


Since your File object already points to that location.
 
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd prefer mkdirs since that also creates any missing parent folders.
 
Moieen Khatri
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.

I tried to create the folder in the manner below but without success


The value of success variable is false when the program is run and the folder is not created

Any ideas about this behaviour?

Thanks

 
Martin Vanyavchich
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Rob Prime suggested, try changing mkdir to mkdirs.


to

 
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aren't you trying to create a folder called Protocol deviation.mdb there? Seems a bit strange (though that shouldn't be what is causing the error, unless that file already exists).
 
Moieen Khatri
Ranch Hand
Posts: 144
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks alot Matthew!

I was trying to create the folders with the same name as the files at the same level.

Silly me!

changing the name of the folder did the trick.

Once again thanks to all of you who helped me resolve this

Kind Regards

Moieen

 
reply
    Bookmark Topic Watch Topic
  • New Topic