[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

how to identify c drive exists in windows

hi,
i need to create the folder through java.Before creating the folder i need to check the Opertaing systen is linux or windows?
If it is windows then check c:\ drive exists and create folder in that?
how to identify c:\exists in windows
0
Rocking
Asked:
Rocking
  • 3
1 Solution
 
CEHJCommented:
http://technojeeves.com/index.php/aliasjava1/16-javasystemproperties

Use "os.name"

boolean cExists = new File("C:/").exists();

Open in new window

0
 
RockingAuthor Commented:
in case if the c: drive does not exists and i need to create a folder on that system.
how to identify which drives exists in windows?
0
 
CEHJCommented:
http://docs.oracle.com/javase/8/docs/api/java/io/File.html#listRoots

I don't think it's even possible for C: to be absent actually
0
 
CEHJCommented:
:)
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now