Blame Automation/Manuals/tcar_getFilesList.sh.asciidoc

Alain Reguera Delgado 8ea9a9
tcar_getFilesList.sh(1)
Alain Reguera Delgado 8ea9a9
=======================
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
== Name
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
tcar_getFilesList - Create customized list of files for further
Alain Reguera Delgado 8ea9a9
processing.
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
== Synopsis
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
*tcar_getFilesList [--pattern|--mindepth|--maxdepth|--type|--uid] LOCATION*
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
== Description
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
The *tcar_getFilesList* standardizes the way list of files are built
Alain Reguera Delgado 8ea9a9
inside the *centos-art.sh* script.  This function outputs a sorted and
Alain Reguera Delgado 8ea9a9
unique list of files based on the options and location provided as
Alain Reguera Delgado 8ea9a9
argument. This function is an interface to the *find* command. Don't
Alain Reguera Delgado 8ea9a9
use *find* command directly inside the centos-art.sh script. Instead,
Alain Reguera Delgado 8ea9a9
use the *tcar_getFilesList* function.
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
The +LOCATION+ arguments must be the absolute path to a directory and
Alain Reguera Delgado 8ea9a9
specifies where the search of files in any form (e.g., directories,
Alain Reguera Delgado 8ea9a9
links, etc.) will take place in. If +LOCATION+ isn't a directory, the
Alain Reguera Delgado 8ea9a9
script finishes its execution with an error message.
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
The *tcar_getFilesList* accepts the following options:
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
--pattern="REGEX"::
Alain Reguera Delgado 8ea9a9
    This option specifies a posix-egrep type regular expression as
Alain Reguera Delgado 8ea9a9
    value. This regular expression is applied to path specified in
Alain Reguera Delgado 8ea9a9
    +LOCATION+ argument. Only file paths that match this regular
Alain Reguera Delgado 8ea9a9
    expression inside +LOCATION+ directory will be included in the
Alain Reguera Delgado 8ea9a9
    final list of files. By default, if this option is not provided,
Alain Reguera Delgado 8ea9a9
    the ``+^/.*[[:alnum:]_/-]+$+'' regular expression
Alain Reguera Delgado 8ea9a9
    is used.
Alain Reguera Delgado 8ea9a9
+
Alain Reguera Delgado 8ea9a9
When you use the *tcar_getFilesList* you don't need to specified the
Alain Reguera Delgado 8ea9a9
absolute path of files you want to look for.  This is something
Alain Reguera Delgado 8ea9a9
*tcar_getFilesList* already does for you.  When you use this function,
Alain Reguera Delgado 8ea9a9
the value you pass as regular expression isn't the final regular
Alain Reguera Delgado 8ea9a9
expression used. Instead, the regular expression you pass is used to
Alain Reguera Delgado 8ea9a9
build the final regular expression passed to *find* command.  The
Alain Reguera Delgado 8ea9a9
final regular expression passed to find is ``+^/.*${PATTERN}$+'',
Alain Reguera Delgado 8ea9a9
where +${PATTERN}+ is the value you passed to *--pattern* option as
Alain Reguera Delgado 8ea9a9
REGEX.
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
--mindepth="NUMBER"::
Alain Reguera Delgado 8ea9a9
    This option specifies the minimal +NUMBER+ of levels deep the
Alain Reguera Delgado 8ea9a9
    search should go under the directory +LOCATION+ specified. For
Alain Reguera Delgado 8ea9a9
    example, if you specify *--mindepth="2"* the search will start two
Alain Reguera Delgado 8ea9a9
    levels deep considering the path provided as section. 
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
--maxdepth="NUMBER"::
Alain Reguera Delgado 8ea9a9
    This option specifies the maximum +NUMBER+ of levels deep the
Alain Reguera Delgado 8ea9a9
    search should go under the directory +LOCATION+ specified. For
Alain Reguera Delgado 8ea9a9
    example, if you specify *--maxdepth="2"* the search will begin in
Alain Reguera Delgado 8ea9a9
    the very same directory path you provided as +LOCATION+ and stop
Alain Reguera Delgado 8ea9a9
    two levels deep using it as section.
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
--type="STRING"::
Alain Reguera Delgado 8ea9a9
    This option specifies the type of files being searched. This
Alain Reguera Delgado 8ea9a9
    option accepts the same values the *find* *-type* option does.
Alain Reguera Delgado 8ea9a9
    However, the following +STRING+ values are the most used inside
Alain Reguera Delgado 8ea9a9
    the script so far:
Alain Reguera Delgado 8ea9a9
+
Alain Reguera Delgado 8ea9a9
- d — directory.
Alain Reguera Delgado 8ea9a9
- f — regular file.
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
--uid="NUMBER"::
Alain Reguera Delgado 8ea9a9
    This option specifies the numeric user id of the files you want to
Alain Reguera Delgado 8ea9a9
    search. Only files that match this numeric user id will be added
Alain Reguera Delgado 8ea9a9
    to the final list of files.
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
Use the *tcar_getFilesList* whenever you need to build list of files
Alain Reguera Delgado 8ea9a9
for further processing.
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
== Bugs
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
See https://centos.org.cu/bugs/
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
== Authors
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
The *tcar_checkFiles* function has received contributions from the
Alain Reguera Delgado 8ea9a9
following people:
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
- Alain Reguera Delgado <al@centos.org.cu>, =COPYRIGHT_YEAR_LIST=
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
== License
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
Copyright (C) =COPYRIGHT_YEAR_LIST= =COPYRIGHT_HOLDER=
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
This program is free software; you can redistribute it and/or modify
Alain Reguera Delgado 8ea9a9
it under the terms of the GNU General Public License as published by
Alain Reguera Delgado 8ea9a9
the Free Software Foundation; either version 2 of the License, or (at
Alain Reguera Delgado 8ea9a9
your option) any later version.
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
This program is distributed in the hope that it will be useful, but
Alain Reguera Delgado 8ea9a9
WITHOUT ANY WARRANTY; without even the implied warranty of
Alain Reguera Delgado 8ea9a9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Alain Reguera Delgado 8ea9a9
General Public License for more details.
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
You should have received a copy of the GNU General Public License
Alain Reguera Delgado 8ea9a9
along with this program; if not, write to the Free Software
Alain Reguera Delgado 8ea9a9
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Alain Reguera Delgado 8ea9a9
Alain Reguera Delgado 8ea9a9
// vim: set syntax=asciidoc: