-
Notifications
You must be signed in to change notification settings - Fork 5
15. FileUtil
in most of our projects, we basically have a FileUtil, because our projects are still very important and diverse for file operations.
so I think it is still necessary to include file tools to solve most file operations.
generally speaking, the file tool category includes the following operating tools:
- file operations: create, delete, copy, move, and rename file directories.
- file judgement: judge whether it is a file, judge whether it is a directory, judge whether the file or folder is empty.
- file name: get the file name of the file, get the file extension.
because I am a fan of the Linux operating system, I really like some of the API naming and logical structure of Linux, which is fully reflected in FileUtil at this time. I did not choose createFile to create a file but chose touch. I personally think that this method will greatly improve the speed of using xiaoTools for those who are more familiar with Linux systems; of course, for those who are not very familiar with Linux operations As far as system users are concerned, they can also be familiar with Linux operation when using it.
View all files and folders in the directory.
File[] files = FileUtil.ls("path");
to learn more, refer to the API documentation