Blame Scripts/Documentation/Reference/Tcar/tcar_getFilesList.asciidoc

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