Home > Common Problem > body text

How to rename and move files with spaces in their names from the command line

王林
Release: 2023-04-17 10:55:02
forward
2325 people have browsed it

Interacting with files with spaces in their names from the quoted command line

The easiest way to interact with files with spaces in their names is to use quotes.

For example, if we try to move a file named "Sample File.pdf", the command used is as follows:

mv "Sample File.pdf" ~/ Path/To/Destination/

Or rename "Sample File.pdf" will look like this:

mv "Sample File.pdf" "Sample File 2. pdf"

Modify files with spaces in their names from the terminal by escaping

You can also use backslashes to escape the spaces, but for most users this will It's not as simple as using quotes. This will look like this:

mv Sample\ File.pdf ~/Path/To/Destination/

Note how the \ precedes the space in the file name.

Again, using quotes is the easiest and most straightforward method for most users, but you are free to use the escaped slash method as well.

The above is the detailed content of How to rename and move files with spaces in their names from the command line. For more information, please follow other related articles on the PHP Chinese website!

source:yundongfang.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template