Common functions need to refer to the static method that System.IO directly can call path 1 class Program 2 {3 static void Main (string[] args) 4 {5 6//Get the current running program's Directory 7 string filedir = Environment.currentdirectory; 8
1:OS. Listdir (PATH) // path is the Directory
The function is equivalent to executing the Dir command in the path directory. The returned result is of the list type.PrintOS. Listdir ('..')
2:OS. Path.Walk(Path, visit, ARG)
Path: the
File operations are very basic and important content in the program, while paths, files, directories, and I/O are common topics in file operations, I would like to summarize these common problems and try to provide some solutions for each problem.
1:os.listdir (Path)//path as a directory
function is equivalent to executing the dir command in the path directory, returning to the list type
Print Os.listdir ('.. ')
2:os.path.walk (Path,visit,arg)
Path: Is the directory that will be
File operations are very basic and important in the program, and the path, files, directories and I/O are common topics in the file operation, here want to summarize these common problems, for each problem, as far as possible to provide some
1:os.listdir (path)//path as Directory
function is equivalent to executing the dir command in the path directory, returning to the list type
Print Os.listdir ('.. ')
2:os.path.walk (Path,visit,arg)
Path: Is the directory that will be traversed
Visit:
1. How to obtain the current file path
Frequently used:
String type: system. getproperty ("user. dir ");
Overall:
Package com. zcjl. Test. base;Import java. Io. file;Public class test {Public static void main (string [] ARGs) throws exception
1. How to obtain the current file path
Frequently used:
String type: system. getproperty ("user. dir ");
Overall:
Package com. zcjl. Test. base;Import java. Io. file;Public class test {Public static void main (string [] ARGs) throws exception
Windows paths are something we often use. They seem simple and actually imply many details, which are not noticed during normal use. Next let's take a look at a variety of Windows paths.
When we mention the path, we will all think of "absolute
In the process of learning Java, the concepts of multiple environment variables (environment variable), such as path, are involved. Correctly configuring these environment variables is a prerequisite for the smooth learning and development. And
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.