Temporary file

Updated: 02/07/2022 by Computer Hope
Temporary folder

Alternatively called a foo file, a temporary file or temp file is a file created to hold information while a file's being created or modified. After the program is closed, the temporary file is deleted. Temporary files store and move data, manage settings, help recover lost data, and manage multiple users.

How are temporary files named?

A temporary file name varies depending on the program and operating system used. For example, Microsoft Windows and Windows programs often create a file with a .tmp file extension as a temporary file. Programs like Microsoft Word may create a temporary hidden file beginning with a tilde and a dollar sign (e.g., ~$example.doc) in the same directory as the document. Programs in Linux may create temporary files with a .foo file extension.

Where are temporary files stored?

The location of a temporary file also varies depending on the program and operating system. With Microsoft Windows, there has always been some form of a temporary directory. Early versions of Windows used the C:\Windows\Temp directory and new versions of Windows store the temp directory in the AppData folder.

Tip

All users with recent versions of Windows (e.g., Windows 7, 8, and 10) can click Start and type %temp% to open the temporary directory.

Many programs may also not use the operating systems temporary directory and instead store temporary files in a folder in the programs folder.

Is it safe to delete temporary files?

Yes. Temporary files are meant to store information temporarily and don't rely on the information stored in the file. However, deleting a temporary file that is in use may cause errors with the program. To help prevent problems, many programs lock the file while in use to prevent it from being deleted.

When a program creates a temporary file, it's deleted after the document or program using that temporary file is closed. If all programs are closed and temporary files still exist, they can all safely be deleted.

If the temporary file is needed again after it's deleted, it is recreated when the program is opened again.

Dummy, Foo, Operating system terms, Orphan file, Temp, Template, Temporary directory