Skip to main content
Creating, Deleting, and Maintaining Files

The following topics describe how to create, delete, and maintain files.

In this section


Naming Files, Paths, and Namespaces

Rules, conventions, and limitations of names for files and directories, including naming conventions, short file names vs. long file names, fully qualified paths vs. relative paths, maximum path length limitation, 8.3 file names, and namespaces.

Creating and Opening Files

Considerations for creating or opening a file by using the CreateFile function.

Moving and Replacing Files

Considerations for moving and replacing files by using the CopyFileEx, CreateFile, Replacefile, and MoveFileEx functions.

Closing and Deleting Files

To use operating system resources efficiently, an application should close files when they are no longer needed by using the CloseHandle function. If a file is open when an application terminates, the system closes it automatically.

Defragmenting Files

Defragmentation is the process of moving portions of files around on a disk to defragment files, that is, the process of moving file clusters on a disk to make them contiguous.