Temporary folder

From Wikipedia, the free encyclopedia

Template:Short description

Page Module:Message box/ambox.css has no content.

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.

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-like systems, 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, tmpfs file systems, or the shared-memory device Page Template:Mono/styles.css has no content./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 Page Template:Mono/styles.css has no content.TEMP or Page Template:Mono/styles.css has no content.TMP.[1] Using the Windows API, one can find the path to the temporary directory using the Page Template:Mono/styles.css has no content.GetTempPath2 function,[2] or one can obtain a path to a uniquely-named temporary file using the Page Template:Mono/styles.css has no content.GetTempFileName function.[3] Originally, the default was Page Template:Mono/styles.css has no content.C:\Temp, then Page Template:Mono/styles.css has no content.%WinDir%\Temp. In the Windows XP era, the temporary directory was set per-user as Page Template:Mono/styles.css has no content.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 Page Template:Mono/styles.css has no content.C:\Users\User NamePage Template:Mono/styles.css has no content.\AppData\Local\Temp (Page Template:Mono/styles.css has no content.%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 Page Template:Mono/styles.css has no content.%TMP% or Page Template:Mono/styles.css has no content.%TEMP%. As with other environmental variables, Page Template:Mono/styles.css has no content.%TMP% or Page Template:Mono/styles.css has no content.%TEMP% is synonymous with the full path.

In Unix-like systems, the global temporary directories are Page Template:Mono/styles.css has no content./tmp and Page Template:Mono/styles.css has no content./var/tmp. Web browsers periodically write data to the tmp directory during page views and downloads. Typically, Page Template:Mono/styles.css has no content./var/tmp is for persistent files (as it may be preserved over reboots), and Page Template:Mono/styles.css has no content./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). macOS provides user-specific temporary directories and sets TMPDIR to refer to that directory; a sandboxed application cannot use the standard Unix locations, but may use that user-specific directory, the path is provided by the function Page Template:Mono/styles.css has no content.NSTemporaryDirectory.[6]

In OpenVMS, Page Template:Mono/styles.css has no content.SYS$SCRATCH[7] and in AmigaDOS Page Template:Mono/styles.css has no content.T: are used.

See also

References

Page Template:Reflist/styles.css has no content.

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

Template:Computer files