Files » obtaining a list of files and their paths
This commit is contained in:
parent
0b91070e4a
commit
4d8b867007
@ -24,4 +24,12 @@ To obtain this list with a relative path, use:
|
||||
find .
|
||||
\end{Verbatim}
|
||||
|
||||
To find only certain types of files (in this case jpgs) and redirect this information to a file, use something like this:
|
||||
|
||||
\begin{Verbatim}[]
|
||||
find . \( name "*.jpg" -o name "*.jpeg" \) > jpglist.txt
|
||||
\end{Verbatim}
|
||||
|
||||
Because this is bash, the parentheses are not a capture group (as in regex), but operators used to force precedence and need to be escaped, because parentheses are special to the shell. (Normally we would use quotation marks, but because we need to use quotation marks with the \texttt{name} test, we are using backslashes). Likewise, the \texttt{-o} is a Boolean ``or'', meaning that the second expression will not be evaluated if the first one is true. For more information, use \texttt{man find}.
|
||||
|
||||
\ktcbox{Sometimes you need a list of files with their filepaths, and these tools will do that. Unfortunately, Linux does not have a way to put the file first, so the way to do this is to redirect \texttt{stdout} to a \texttt{.csv} file and manipulate the output in a spreadsheet.}
|
||||
@ -9,8 +9,8 @@
|
||||
%%% Get it started
|
||||
\checkandfixthelayout % Required if you have altered settings for the memoir class
|
||||
% Make an index
|
||||
\makeindex[columns=3, title=Packages Mentioned, intoc]
|
||||
\makeindex[name=concepts, columns=3, title=Concepts, intoc]
|
||||
\makeindex[title=Commands, intoc, columnseprule]
|
||||
\makeindex[name=concepts, title=Concepts, intoc, columnseprule]
|
||||
\begin{document}
|
||||
|
||||
\pagenumbering{roman}
|
||||
@ -45,6 +45,7 @@
|
||||
\input{chapters/ch01-images}
|
||||
\input{chapters/ch02-text}
|
||||
\input{chapters/ch03-files}
|
||||
\input{chapters/ch04-system}
|
||||
|
||||
\printindex
|
||||
\printindex[concepts]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user