Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux rename command usage in learning to modify the file name     - Nginx request processing (Server)

- Linux (Ubuntu) How iptables port mapping (Server)

- OpenCV cvFindCornerSubPix () to find sub-pixel Corner (Programming)

- Detailed steps - GAMIT solver (Linux)

- MariaDB database storage path modify configuration issues (Database)

- EXP-00091: Exporting questionable statistics Processing Method (Database)

- RedHat yum configuration and the prompt (Linux)

- Zabbix monitoring of the switch (Server)

- Heartbeat (v1, v2, pacemaker) cluster components Overview (Server)

- Why is the ibdata1 file growing in MySQL? (Database)

- You may not know the Linux command-line network monitoring tool (Linux)

- EXP-00091 Error resolved (Database)

- Use Ansible efficient delivery Docker container (Server)

- Transfer MySQL database to MariaDB (Database)

- Ftp user to create multiple virtual machines to support different access rights Examples (Server)

- Advanced Search Oracle study notes (Database)

- Use preseed script to install Ubuntu 14.04 (Linux)

- User rights management system under Linux (Linux)

- Linux C programming and Shell Programming in the development of practical tools similarities summary (Programming)

- Linux system started to learn: how to solve the xxx is not in the sudoers file error (Linux)

 
         
  Linux rename command usage in learning to modify the file name
     
  Add Date : 2018-11-21      
         
         
         
  How to modify the command file name it? You can use the rename command, of course, you can also use the mv command in Linux, here to share under Linux rename command usage.

There are some people that there is no rename command under Linux, I recommend using the mv command.
Mv command to rename command and rename the file to do in terms of a comparison, we chose to use it according to personal likes.

mv command, described in the man mv to mv command:
mv -move (rename) files

You can see the mv command to rename does have features, but the actual application, it can only rename a single file, the command is as follows:
mv [path /] oldfilename [path /] newfilename

"Mv command can only rename a single file," which is the real mv command and rename commands to rename a fundamental difference in the area.

rename command in the man rename description:
NAME
rename -Rename files
SYNOPSIS
rename from to file ....

DESCRIPTION

rename will rename the specified files by replacing the first occurrence of from in their name by to.

For example, given the files foo1, ..., foo9, foo10, ..., foo278, the commands

rename foo foo0 foo?

rename foo foo0 foo ??

will turn them into foo001, ..., foo009, foo010, ..., foo278.

And

rename .htm .html * .htm

will fix the extension of your html files.

It can be seen rename command is specific to rename the file, and in accordance with the subsequent examples can be seen, in addition to a single file rename rename can also batch file renaming.
Note, rename command with three parameters instead of a lot of people think that the two parameters.

The above example shows two file batch rename usage, in fact, rename using wildcards in combination, it features more powerful than the example shown above.

Basic wildcards are the following:
? Can replace a single character
* Can replace multiple characters

[Charset] can replace any single character set charset

Explanation:
As the folder with these files foo1, ..., foo9, foo10, ..., foo278, if used
rename foo foo0 foo?

Then only will foo1 to foo9 file rename foo01 to foo09, because? Wildcard can only replace a single character, it was just renamed file has the file name length of four characters, the file name is replaced with foo foo0.

Continue to use
rename foo foo0 foo ??

Then all the files in the folder to foo99 foo01 have been renamed to foo001 to foo099, and its subsequent foo100 file name will remain unchanged, because the wildcard? To use, so just rename the five characters in the file name length, file name foo is replaced foo0.

If you continue to use
rename foo foo0 foo *

All files foo001 to foo278 have been renamed to foo0001 to foo0278, because the wildcard * to replace multiple characters, all starting with foo files are renamed, the file name foo is replaced foo0.

Look wildcard [charset] usage, or continue in the above mentioned folder, run the following command
rename foo0 foo foo0 [2] *

All files from foo0200 to foo0278 have been renamed to foo200 to foo278, file name foo0 is replaced foo.

In use the three wildcards can be used in conjunction.

In short, both the rename command, or mv commands can be done to modify the file name, the use of more attention to different parameters and usage.
     
         
         
         
  More:      
 
- Oracle PL / SQL based cursor (Database)
- Sublime Text Add instructions to insert the current time zone (Linux)
- Linux Operating System Security Study (Linux)
- How to install and configure the KVM and Open vSwitch on Linux distributions (Linux)
- Linux keyboard recording script (Linux)
- Ubuntu 12.04 configure NVIDIA CUDA 5.5 Record (Linux)
- Ubuntu 15.10 installation and deployment Swift development environment (Linux)
- CentOS 7 How to install MySQL Server (Database)
- Android Studio Installation and Configuration Guide tutorial (Linux)
- iTerm - let your command line can also be colorful (Linux)
- Linear table with a Java implementation of the iterator (Programming)
- How to set the default Fedora from the command line (Linux)
- Python script file directory traversal examples (Programming)
- A well-known but rarely used skills: object pool (Programming)
- RHEL5 multipath configuration (Linux)
- Linux5 install MySQL 5.6 (RPM mode) (Database)
- Install Java JDK 8 in CentOS 7 / 6.5 / 6.4 (Linux)
- Linux screen commonly commands (Linux)
- Linux IPTables anti-DDOS attack Shell Scripting (Linux)
- PostgreSQL transaction model introduction (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.