Added «mmv» to Files chapter

This commit is contained in:
Kenneth John Odle 2026-08-24 08:27:10 -04:00
parent 9a2a0017bc
commit a2dfb86359

View File

@ -10,6 +10,44 @@ fooabi.txt
foo38r.txt
\end{Verbatim}
To remove the ``foo'', use this command:
\begin{Verbatim}[]
mmv 'foo*' '#1'
\end{Verbatim}
To change ``foo'' to ``bar'', use:
\begin{Verbatim}[]
mmv 'foo*' 'bar#1'
\end{Verbatim}
The \texttt{mmv} command uses this command structure:
\begin{Verbatim}[]
mmv [-m|x|r|c|o|a|l|s] [-h] [-d|p] [-g|t] [-v|n] [--] [from to]
\end{Verbatim}
For a full discussion of those, see the ``man'' page. The key concept here is that wildcard characters in the ``from'' option get replaced with ``\#1'', ``\#2'' etc in the ``to'' option, in the order they are encountered. So it is possible to reorder elements of file names. For example, to exchange ``foo'' in our list above for the file extension, we would use:
\begin{Verbatim}[]
mmv 'foo*.txt' 'txt#1.foo'
\end{Verbatim}
To reverse the order of the last three characters of the filenames, we would use:
\begin{Verbatim}[]
mmv 'foo???.txt' 'foo#3#2#1.txt'
\end{Verbatim}
That would produce this list of files:\index{mmv}
\begin{Verbatim}[]
foo341.txt
fooiba.txt
foor83.txt
\end{Verbatim}
\lettrine{T}{his} can also be accomplished by using the \textbf{rename}\index{rename} command.
\section{Obtain a List of Files and their Paths}