ren

changes a name without changing its parent directory

FilesVersion 1.2.4Stable
lil-terminal

Overview

ren changes a name without changing its parent directory. For example, ren draft.txt final.txt renames a file; ren archive renames the current directory to archive. Use mov when the parent directory should change too.

Change the name, not the location

Use ren for a new name in the same folder. Use mov to relocate a file or folder. Check the destination carefully before using -f.

Syntax

lil-terminal
ren [-f] <new> · <src> <new>

Reference

ren <new>

rename the current directory

ren <src> <new>

rename a file or directory

ren <src> <new> -f

rename over an existing file, link or empty directory

ren -- <new>

allow names starting with a hyphen

Notes

The new name must not contain / or \; . and .. are not valid names. Existing destinations are preserved unless you specify -f. Forced mode can replace a compatible file, link or empty directory, never a non-empty directory. Use ren -- -draft.txt for a name starting with a hyphen.

Safety

If a renamed directory contains the active working or base directory, lil-terminal updates the tracked paths. Success returns a compact directory listing rather than a separate “Renamed” message.

Interactive sandbox preview

Run the prepared examples directly on the page. Their results are prebuilt and shown in the browser; no terminal command is executed on the server.

Rename a file or directory

Install and manage

Install the current compatible version. Choose Base for the complete feature set or Minimum for the reduced package; use upgrade to update a module that is already installed.

Base and Minimum are two packages of the same current module release, not separate command versions.

Base package

Install the complete package with local command reference and every published mode.

install ren
Minimum package

Install the reduced package. Local reference is omitted; help <cmd> -i opens the current server reference.

install ren -m
Exact public version

Install exactly this published version.

install ren -v 1.2.4
Check or update

Ask upgrade to check compatibility and replace the installed block only when needed.

upgrade ren
Remove module

Remove the extension block while leaving the core and unrelated modules intact.

install ren -u

Examples

Examples are copyable command lines, not actions executed by this website. Review paths, permissions and destructive flags before running them on a real project.

Rename a file or directory
cd \sandbox\tmp | ren draft.txt final.txt
README.txt
current.txt
final.txt
new.txt
Rename a file or directory
ren \sandbox\tmp\new.txt current.txt
Destination already exists
Rename over an existing file, link or empty directory
ren \sandbox\tmp\new.txt current.txt -f
README.txt
current.txt
draft.txt
Rename the current directory
cd \sandbox\workspace | ren archive | pwd
original.txt
updated.txt
replace.txt

/home/account/public_html/sandbox/archive
Rename a file or directory
ren \sandbox\tmp\draft.txt nested/final.txt
Invalid name
Allow names starting with a hyphen
cd \sandbox\tmp | ren draft.txt -- -draft.txt
README.txt
current.txt
-draft.txt
new.txt

File used in this example: sandbox/workspace/original.txt

The example uses a file or directory from the protected /sandbox/ documentation workspace.

alpha
beta
gamma

Related documentation

Current public release

v1.2.42026-10-31

Safer rename replacement and hyphenated names

Forced renaming now preserves the destination if the rename fails.