Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pages/common/rename.md → pages/linux/rename.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# rename

> Renames multiple files.
> This is the perl version of `rename`, which is the default on Debian. See `rename.ul` for the stand-alone version.
- Rename files using a Perl Common Regular Expression (substitute 'foo' with 'bar' wherever found):

Expand Down
29 changes: 29 additions & 0 deletions pages/linux/rename.ul.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# rename.ul

> Renames multiple files.
> This is the util-linux version of `rename`. See `rename` for the perl version which is default on Debian.
> Warning: The renaming has no safeguards and will overwrite files without any questions.
- Rename files using simple substitutions (substitute 'foo' with 'bar' wherever found):

`rename {{foo}} {{bar}} {{*}}`

- Dry-run - display which renames would occur without performing them:

`rename -vn {{foo}} {{bar}} {{*}}`

- Do not overwrite existing files:

`rename -o {{foo}} {{bar}} {{*}}`

- Change file extensions:

`rename {{.ext}} {{.bak}} *.foo`

- Prepend all files with 'foo':

`rename '' 'foo' {{*}}`

- Rename 'foo1', ..., 'foo10', ..., 'foo100' to 'foo001', ..., 'foo010', ..., 'foo100':

`rename {{foo}} {{foo00}} {{foo?}} && rename {{foo}} {{foo0}} {{foo??}}`