1
0
Fork
You've already forked Moveto
0
The mvto command is designed to rename specific parts of filenames based on a supplied pattern.
  • C 75.4%
  • Makefile 24.6%
2024年06月17日 14:48:08 +00:00
.gitignore Remove object file 2024年06月16日 21:52:02 +02:00
main.c Add support for multiple files at once 2024年06月16日 22:22:34 +02:00
Makefile Add support for multiple files at once 2024年06月16日 22:22:34 +02:00
README.md Update README.md 2024年06月17日 14:48:08 +00:00

Moveto

Description

The mvto command renames a single file by replacing occurrences of a specified pattern with a replacement text.

Functionality

  • Matching: It searches for occurrences of the specified pattern within the filename.
  • Renaming: Replaces the pattern with the specified replacement text in the filename.

Examples

Example 1:

Rename file1.txt by replacing the part "1.txt" with "2.pdf":

mvto 1.txt 2.pdf file1.txt

Result: Renames file1.txt to file2.pdf.

Example 2:

Rename my-file.txt by replacing "my-" with "your-":

mvto my- your- my-file.txt

Result: Renames my-file.txt to your-file.txt.

Example 3:

Rename photo.jpg by replacing the part ".jpg" with ".png":

mvto .jpg .png photo.jpg

Result: Renames photo.jpg to photo.png.

Example 4:

Rename multiple files a-very-old-old-old-file.txt, old-file.txt, another-older-file.txt by replacing all occurrences of "old" with "new":

mvto old new a-very-old-old-old-file.txt old-file.txt another-older-file.txt

Result: Renames the files to:

 new-file.txt
 another-newer-file.txt
 a-very-new-new-new-file.txt

Installation

Build the executable:

make

Install the command:

sudo make install

Uninstall the command:

sudo make uninstall

Clean up the build files:

make clean

Usage Notes

  • The pattern should match exact occurrences within the filename.
  • If no occurrences of the pattern are found in the filename, the filename remains unchanged.
  • The command operates on filenames in the current directory unless an absolute or relative path is specified.

Author: Amir Teymuri (amtework[at]gmail[dot]com)