In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article shares with you the content of a sample analysis of java folder operations. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Folder operation
Package com.file;import java.io.File;/** * Created by elijahliu on 2017-2-11. * / public class HelloFolder {public static void main (String [] args) {File folder = new File ("my newfolder"); if (folder.mkdir ()) {/ / create a folder to determine whether System.out.println is successful ("folder creation completed"); File newfolder = new File ("myn new foleder-new") Folder.renameTo (newfolder); / / the folder renamed here can change the folder name at one level separately, while the folder below this level keeps the directory structure if (folder.delete ()) {System.out.print ("done"). / the deletion here can only delete an empty folder. If there is something in the folder, it cannot be deleted. Directly deleting a non-empty folder without asking is very irresponsible} else {System.out.println ("fail");}} else {if (folder.exists ()) {System.out.println ("folder already exists without creating") } else {System.out.println ("folder creation failed");} File folders = new File ("my new folder/one/two/three/main"); folders.mkdirs (); / / you can only create one with mkdir in java, and mkdirs can create multi-level directories}} thank you for reading! This is the end of this article on "sample Analysis of java folder Operation". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.