Temporary folder

Last updated

In computing, a temporary folder or temporary directory is a directory used to hold temporary files. Many operating systems and some software automatically delete the contents of this directory at bootup or at regular intervals, leaving the directory itself intact.

Contents

For security reasons, it is best for each user to have their own temporary directory, since there has been a history of security vulnerabilities with temporary files due to programs incorrect file permissions or race conditions.

A standard procedure for system administration is to reduce the amount of storage space used (typically, on a disk drive) by removing temporary files. In multi-user systems, this can potentially remove active files, disrupting users' activities. To avoid this, some space-reclaiming procedures remove only files which are inactive or "old" - those which have not been read or modified in several days.

Practical issues

In Unix, the /tmp directory will often be a separate disk partition. In systems with magnetic hard disk drives, performance (overall system IOPS) will increase if disk-head movements from regular disk I/O are separated from the access to the temporary directory. Increasingly, memory-based solutions for the temporary directory or folder are being used, such as "RAM disks" set up in random-access memory or the shared-memory device /dev/shm in Linux.

A Flash-based solid-state drive is less suitable as a temporary-storage device for reading and writing due to the asymmetric read/write duration and due to wear. (See wear leveling.)

Traditional locations

In MS-DOS and Microsoft Windows, the temporary directory is set by the environment variable TEMP or TMP [1] . Using the Window API, one can find the path to the temporary directory using the GetTempPath2 function [2] , or one can obtain a path to a uniquely-named temporary file using the GetTempFileName function [3] . Originally, the default was C:\Temp, then %WinDir%\Temp. In the Windows XP era, the temporary directory was set per-user as Local Settings\Temp, although still user-relocatable. For Windows Vista, 7, 8, and 10 the temp location has moved again to within the AppData section of the User Profile, typically C:\Users\User Name\AppData\Local\Temp (%USERPROFILE%\AppData\Local\Temp). In all versions of Windows, the Temp location can be accessed, for example, in Explorer, "Run..." boxes and in an application's internal code by using %TMP% or %TEMP%. As with other environmental variables, %TMP% or %TEMP% is synonymous with the full path.

In Unix and Linux, the global temporary directories are /tmp and /var/tmp. Web browsers periodically write data to the tmp directory during page views and downloads. Typically, /var/tmp is for persistent files (as it may be preserved over reboots), and /tmp is for more temporary files. See Filesystem Hierarchy Standard. [4] [5] In addition, a user can set their TMPDIR environment variable to point to a preferred directory (where the creation and modification of files is allowed).

In macOS, a sandboxed application cannot use the standard Unix locations, but may use a user-specific directory whose path is provided by the function NSTemporaryDirectory. [6]

In OpenVMS, SYS$SCRATCH [7] and in AmigaDOS T: are used.

See also

Related Research Articles

A file manager or file browser is a computer program that provides a user interface to manage files and folders. The most common operations performed on files or groups of files include creating, opening, renaming, copying, moving, deleting and searching for files, as well as modifying file attributes, properties and file permissions. Folders and files may be displayed in a hierarchical tree based on their directory structure.

Disk partitioning Creation of separate accessible storage areas on a secondary computer storage device

Disk partitioning or disk slicing is the creation of one or more regions on secondary storage, so that each region can be managed separately. These regions are called partitions. It is typically the first step of preparing a newly installed disk, before any file system is created. The disk stores the information about the partitions' locations and sizes in an area known as the partition table that the operating system reads before any other part of the disk. Each partition then appears to the operating system as a distinct "logical" disk that uses part of the actual disk. System administrators use a program called a partition editor to create, resize, delete, and manipulate the partitions. Partitioning allows the use of different filesystems to be installed for different kinds of files. Separating user data from system data can prevent the system partition from becoming full and rendering the system unusable. Partitioning can also make backing up easier. A disadvantage is that it can be difficult to properly size partitions, resulting in having one partition with too much free space and another nearly totally allocated.

cd (command) Computer command in various operating systems

The cd command, also known as chdir, is a command-line shell command used to change the current working directory in various operating systems. It can be used in shell scripts and batch files.

mkdir Command used to make a new directory

The mkdir command in the Unix, DOS, DR FlexOS, IBM OS/2, Microsoft Windows, and ReactOS operating systems is used to make a new directory. It is also available in the EFI shell and in the PHP scripting language. In DOS, OS/2, Windows and ReactOS, the command is often abbreviated to md.

In computing, a symbolic link is a term for any file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution.

A home directory is a file system directory on a multi-user operating system containing files for a given user of the system. The specifics of the home directory are defined by the operating system involved; for example, Linux / BSD (FHS) systems use /home/⟨username⟩ and Windows systems between 2000 and Server 2003 keep home directories in a folder called Documents and Settings.

A path is a string of characters used to uniquely identify a location in a directory structure. It is composed by following the directory tree hierarchy in which components, separated by a delimiting character, represent each directory. The delimiting character is most commonly the slash ("/"), the backslash character ("\"), or colon (":"), though some operating systems may use a different delimiter. Paths are used extensively in computer science to represent the directory/file relationships common in modern operating systems, and are essential in the construction of Uniform Resource Locators (URLs). Resources can be represented by either absolute or relative paths.

tmpfs is a temporary file storage paradigm implemented in many Unix-like operating systems. It is intended to appear as a mounted file system, but data is stored in volatile memory instead of a persistent storage device. A similar construction is a RAM disk, which appears as a virtual disk drive and hosts a disk file system.

In computing, a hard link is a directory entry that associates a name with a file. Thus, each file must have at least one hard link. Creating additional hard links for a file makes the contents of that file accessible via additional paths. This causes an alias effect: a process can open the file by any one of its paths and change its content. By contrast, a soft link or “shortcut” to a file is not a direct link to the data itself, but rather a reference to a hard link or another soft link.

A temporary file is a file created to store information temporarily, either for a program's intermediate use or for transfer to a permanent file when complete. It may be created by computer programs for a variety of purposes, such as when a program cannot allocate enough memory for its tasks, when the program is working on data bigger than the architecture's address space, or as a primitive form of inter-process communication.

In computing, a named pipe is an extension to the traditional pipe concept on Unix and Unix-like systems, and is one of the methods of inter-process communication (IPC). The concept is also found in OS/2 and Microsoft Windows, although the semantics differ substantially. A traditional pipe is "unnamed" and lasts only as long as the process. A named pipe, however, can last as long as the system is up, beyond the life of the process. It can be deleted if no longer used. Usually a named pipe appears as a file, and generally processes attach to it for IPC.

File system Format or program for storing files and directories

In computing, file system or filesystem is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one large body of data with no way to tell where one piece of data stopped and the next began, or where any piece of data was located when it was time to retrieve it. By separating the data into pieces and giving each piece a name, the data is easily isolated and identified. Taking its name from the way a paper-based data management system is named, each group of data is called a "file." The structure and logic rules used to manage the groups of data and their names is called a "file system."

A versioning file system is any computer file system which allows a computer file to exist in several versions at the same time. Thus it is a form of revision control. Most common versioning file systems keep a number of old copies of the file. Some limit the number of changes per minute or per hour to avoid storing large numbers of trivial changes. Others instead take periodic snapshots whose contents can be accessed with similar semantics to normal file access.

In computing, and specifically in the context of Microsoft Windows operating systems, Microsoft refers to Folder Redirection when automatically re-routing I/O to/from standard folders (directories) to use storage elsewhere on a network.

On Microsoft Windows, a special folder is a folder that is presented to the user through an interface as an abstract concept instead of an absolute folder path. Special folders make it possible for any application to ask the operating system where an appropriate location for certain kinds of files can be found; independently of which version or user language of Windows is being used.

TMPDIR is the canonical environment variable in Unix and POSIX that should be used to specify a temporary directory for scratch space. Most Unix programs will honor this setting and use its value to denote the scratch area for temporary files instead of the common default of /tmp or /var/tmp.

Directory (computing) File system structure for locating files

In computing, a directory is a file system cataloging structure which contains references to other computer files, and possibly other directories. On many computers, directories are known as folders, or drawers, analogous to a workbench or the traditional office filing cabinet. The name derives from books like a telephone directory that lists the phone numbers of all the people living in a certain area.

The NTFS file system defines various ways to redirect files and folders, e.g., to make a file point to another file or its contents. The object being pointed to is called the target. There are three classes of links:

Temporary Internet Files is a folder on Microsoft Windows which serves as the browser cache for Internet Explorer to cache pages and other multimedia content, such as video and audio files, from websites visited by the user. This allows such websites to load more quickly the next time they are visited.

In computing, a directory structure is the way an operating system arranges files that are accessible to the user. Files are typically displayed in a hierarchical tree structure.

References

  1. "Recognized Environment Variables". Microsoft. Retrieved 13 March 2022.
  2. "GetTempPath2A function (fileapi.h)". Microsoft. Retrieved 13 March 2022.
  3. "GetTempFileNameA function (fileapi.h)". Microsoft. Retrieved 13 March 2022.
  4. "Temporary files preserved between system reboots". Filesystem Hierarchy Standard. Retrieved 8 March 2022.
  5. "Temporary Files". Filesystem Hierarchy Standard. Retrieved 8 March 2022.
  6. "App Sandbox Design Guide". Apple. Retrieved 7 March 2022.
  7. "VSI OpenVMS User's Manual" (PDF). VMS Software, Inc. p. 244. Retrieved 13 March 2022.