In This Chapter
Using file paths in Cocoa
Finding out about files
Displaying a Files icon in your interface
Copying, moving, creating, and deleting files and folders
Creating a folder
Almost every device that Apple ships sports some kind of storage device. Whether it's the hard drive in your old iPod, a SuperDrive in your desktop Macintosh, or a flash drive in your MacBook Air, all storage devices share one common trait — they store data. To facilitate this storage, the Mac OS X operating system uses a hierarchical system of files.
Cocoa has a large array of functions that you can use to make your file manipulation tasks easier. With only a few lines of code, it's a cinch to open, copy, move, and delete any file or folder on your hard drive, assuming that you have adequate privileges for the file or folder. This chapter shows you how.
Mac OS X has several types of files. You are undoubtedly familiar with the most basic file type — a document. You use document files every time you save work in your favorite word processor. When you want to view the document, you simply reopen it with your word processor.
Documents aren't the only type of file on your Mac, however. Another important file type is the application. You're probably also very familiar with this file type because you use applications to surf the Web, send e-mail, draw pictures, or program with Xcode. In fact, the whole point of Cocoa programming is to ...