Categories
  Encyclosphere.org ENCYCLOREADER
  supported by EncyclosphereKSF

Rename (computing)

From HandWiki - Reading time: 2 min

Renaming a file in Ubuntu 18.04

In computing, rename refers to the altering of a name of a file. This can be done manually by using a shell command such as ren or mv, or by using batch renaming software that can automate the renaming process.

Implementations

The C standard library provides a function called rename which does this action.[1] In POSIX, which is extended from the C standard, the rename function will fail if the old and new names are on different mounted file systems.[2]

In SQL, renames are performed by using the CHANGE specification in ALTER TABLE statements.

Atomic rename

In POSIX, a successful call to rename is guaranteed to have been atomic from the point of view of the current host (i.e., another program would only see the file with the old name or the file with the new name, not both or neither of them). This aspect is often used during a file save operation to avoid any possibility of the file contents being lost if the save operation is interrupted.

The rename function from the C library in Windows does not implement the POSIX atomic behaviour; instead it fails if the destination file already exists. However, other calls in the Windows API do implement the atomic behaviour[citation needed].

References

  1. โ†‘ ISO/IEC 9899:1999 specification. p. 268, ยง 7.19.4.2. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf. 
  2. โ†‘ rename: rename a file โ€“ System Interfaces Reference, The Single UNIX Specification, Issue 7 from The Open Group




Licensed under CC BY-SA 3.0 | Source: https://handwiki.org/wiki/Rename_(computing)
15 views | Status: cached on August 05 2024 12:47:49
↧ Download this article as ZWI file
Encyclosphere.org EncycloReader is supported by the EncyclosphereKSF