Introduction
On an operating system level, files and directories are kind of similar. They are names representing a link to something in storage, whether it is your hard drive, somewhere in the cloud, or the USB drive in your pocket. However, at a conceptual level, they are inherently different. Files contain information, while directories link to other directories and files.
There are two main Application Programming Interface (APIs) that deal with the data: java.io
and java.nio
. Both APIs can be used to navigate directories and manipulate files. The information about the location of a file is called a pathname. It contains the full information of the directory in your hard drive in which the file resides, all the way to the file's name and extension. It should have the following form:
/folder_1/folder_2/[...]/folder_n/file.extension
Different operating systems refer to files and folder structures differently. In Unix systems (such as Linux or macOSX), the /
symbol represents...