Sponsored Content
Operating Systems Linux Fedora Find Files in Directory by Permission? Post 302356134 by varontron on Thursday 24th of September 2009 03:19:43 PM
Old 09-24-2009
the invalid arg error seems like it would have been caused by mixing up the options and args (i.e. -user -u+6 rather than -perm -u+6)

the strange results could be caused by subdirectories. find $directory refers to the search root. you can use the -depth flag to limit directory descending or the
-wholename flag to specificy the path

for result counts, I usually do something like this:

Code:
find ... -print | wc -l

if you need to output the list _and_ get the count, you can do:

Code:
find ... -print > results.txt
COUNT=`wc -l results.txt`

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to find the count of files in a directory

Hi Gurus WHat would be the command to check whether there is a file in particular path or not.. for ex: my file name is ExRate_20071501.csv I can have many files with same pattern but diffrentiated by date.. i have a process where i have to check if files exist in tht folder i have to... (5 Replies)
Discussion started by: sish78
5 Replies

2. Shell Programming and Scripting

How to find a specific files in a many directory

Dear All, Appreciate some help here. I have a log of report. It located in several directory as below: Directory: mysscpr1 mysscpr2 mysscpr3 my_scnpr4 In the directory it contain hundred of files. i need to find a specific files that contain 'invc2345' in the directory. How... (7 Replies)
Discussion started by: selamba_warrior
7 Replies

3. Shell Programming and Scripting

Find files in directory

Hi all I want to find a particular file type lets say .abc under /home/oracle/, the file name is start with 'D' and followed by ddmmyyyy date format, the file name should look like this D19092008.abc To my question, how can i perform the searching from the date 19/09/2008 to 29/09/2008. The... (3 Replies)
Discussion started by: coldstarhk
3 Replies

4. UNIX for Dummies Questions & Answers

Need help to find the files under a directory

Hi, I wanted to delete all the files under a directory "/apps/tmp/" which are two weeks older. But i should not delete the sub-directories and the contents of sub-directories. I also have searched in forum and found the following command, find . \( ! -name . -prune \) -mtime +13 -print ... (8 Replies)
Discussion started by: Sheethal
8 Replies

5. UNIX for Dummies Questions & Answers

Find files and display only directory list containing those files

I have a directory (and many sub dirs beneath) on AIX system, containing thousands of file. I'm looking to get a list of all directory containing "*.pdf" file. I know basic syntax of find command, but it gives me list of all pdf files, which numbers in thousands. All I need to know is, which... (4 Replies)
Discussion started by: r7p
4 Replies

6. UNIX for Dummies Questions & Answers

How to Find Files other than specified directory ?

Hi All, I am creating one script to Archive the older log files to Archive folder and deleting older files. For example below path contains different sub folders. So searching for log files older than 2 days then zip and moving to Archive directory in the same directory. Source files :-... (4 Replies)
Discussion started by: vadlamudy
4 Replies

7. UNIX for Advanced & Expert Users

Find all files in the current directory excluding hidden files and directories

Find all files in the current directory only excluding hidden directories and files. For the below command, though it's not deleting hidden files.. it is traversing through the hidden directories and listing normal which should be avoided. `find . \( ! -name ".*" -prune \) -mtime +${n_days}... (7 Replies)
Discussion started by: ksailesh1
7 Replies

8. UNIX for Dummies Questions & Answers

find Files in sub-directory

Hi Just want to ask, Is it possible to find a file from a directory up to its sub-directories? Thanks, cmarzan (10 Replies)
Discussion started by: cmarzan
10 Replies

9. AIX

How to set owner and permission for files/directory in directory in this case?

Hi. My example: I have a filesystem /log. Everyday, log files are copied to /log. I'd like to set owner and permission for files and directories in /log like that chown -R log_adm /log/* chmod -R 544 /log/*It's OK, but just at that time. When a new log file or new directory is created in /log,... (8 Replies)
Discussion started by: bobochacha29
8 Replies

10. Shell Programming and Scripting

Find list of files missing read & execute permission

Hi, I'm writing a post-upgrade script and I want to find which files don't have read and execute to everyone. I can run a find . ! -perm, but then I have to use a list of the possible permissions (777,775, 755 etc). Is there a more elegant solution? Thanks (2 Replies)
Discussion started by: Catullus
2 Replies
Exporter::Renaming(3pm) 				User Contributed Perl Documentation				   Exporter::Renaming(3pm)

NAME
Exporter::Renaming - Allow renaming of symbols on import SYNOPSIS
# Enable renaming in Exporter use Exporter::Renaming; # Import File::Find::find as main::search use File::Find Renaming => [ find => search]; # Disable renaming no Exporter::Renaming ABSTRACT
Allow Renaming of symbols on Import DESCRIPTION
Overview This module adds the ability to rename symbols to the standard Exporter module. After "use Exporter::Renaming", you can import symbols from exporting modules not only under their original names, but also under names of your choosing. Here, symbol is used to mean anything that could be exported by a Module, that is, a Perl function or variable. Thus a symbol begins with an optional type character (one of "$", "@", "%", "&", and "*"), followed by a name (a Perl identifier, made up of alphanumerics and "_", starting with a non-digit). To trigger renaming behavior, the import list of a subsequent "use <module>" statement must begin with the keyword 'Renaming', followed by a list reference, the <renaming list|/Renaming List>, which describes the renaming imports (see below). After that, a normal import list may follow, which Exporter processes as usual. Renaming List The renaming list contains renaming pairs, which are pairs of symbols. The first part of a pair is the original symbol (as known to the exporting module) and the second one is the renamed symbol (as you want to use it after import). It is an error (fatal, as all "Renaming" or "Exporter" errors) if the renaming list has an odd number of elements, or if one of its symbols is invalid. If none of the symbols in a renaming pair contains a type character, an "&" is assumed. If only one has a type character, this type is assumed for the other one too. If both have type characters, it is an error if they don't agree. If the renamed symbol (the second part) of a renaming pair is undefined, the original symbol is imported unchanged, so you can include normal imports in a renaming list without retyping the name. It is an error for a symbol to appear more than once as the second part of a renaming pair, that is, to specify the same thing twice as the target of a renaming operation. It is allowed to import the same symbol multiple times with different targets. Maybe it even makes sense in some situations. Operation Exporter continues to behave normally for normal imports while renaming behavior is switched on. Only the presence of the keyword "Renaming", followed by an array reference in the first and second positions after a "use" statement triggers renaming. The renaming behavior of Exporter is thus compatible with its standard behavior. If renaming must be switched off for some reason, this can be done via "no Export::Renaming". If an import list contains both a renaming list and a sequence of normal import statements, the renaming is done first, as indicated by its position. No cross-check is done between the results of renaming and the normal imports, as if these resulted from two separate "use" statements. EXAMPLES
All examples assume that use Exporter::Renaming; has been called (and that "no Exporter::Renaming" hasn't). The most obvious application of "Exporter::Renaming" is to solve a name conflict. Suppose our module already defines a function "find", and we want to use the standard "File::Find" module. We could then rename "find" from "File::Find" to "search" in our own module: use File::Find Renaming => [ find => 'search' ]; Let's assume the "finddepth" function from File::Find doesn't cause a name conflict, and we want to import it under its original name as well. This does it in the renaming list: use File::Find Renaming => [ find => 'search', finddepth => undef, ]; ...as does this, but explicitly: use File::Find Renaming => [ find => 'search', finddepth => 'finddepth', ]; ...while this uses a regular import: use File::Find Renaming => [ find => 'search' ], 'finddepth'; Should you find it annoying that a pedantic module author has chosen to adorn all of the module's exports with a redundant prefix (these things happen), you could do this: use Mythical::Graphics::Module Renaming => [ gfxColor => '%color', # this imports a hash gfxPen => 'pen', gfxLine => 'line', # .... # etc ]; ...lower-casing the names as well. If you need to add clarifying prefixes that a sloppy module author has neglected to provide in the exports (these things happen), you go the other way around: use Legendary::Graphics::Module Renaming [ Color => '%gfxColor', Pen => 'gfxPen', Line => 'gfxLine', # ... # etc ]; ...also lower-casing the initial letters. If you are confronted with a standard module that uses a slightly non-standard naming convention (it happens), you can rectify the situation: use Data::Dumper Renaming => [ Dumper => 'dump' ]; Now you can say "print dump %some_hash" instead of "print Dumper ..."; CAVEATS
o As has been mentioned in section Operation, no cross-check is done between renaming exports and normal exports that go on in the same "use" statement. This means that a renaming import may later be overwritten by a normal import without a clear indication. This happens when one of the new names given in renaming coincides with one of the original ones imported through normal import. o "Exporter::Renaming" only affects modules that do standard exporting, that is, modules that inherit their "import" method from Exporter. Modules that use a different "import" method are unaffected and don't understand renaming lists. o Renaming doesn't affect the name c<caller> sees for a function. This should come as no surprise, since normal export doesn't affect this name either. It is always the (package-qualified) name the function was originally compiled with. BUGS
o The lack of a cross-check between renaming and normal imports is regrettable, but unlikely to be fixed unless Renaming is made part of Exporter. Except for the simplest cases, only Exporter can parse an export list. o Calls of "use Exporter::Renaming" and "no Exporter::Renaming" don't nest. Instead of switching unconditionally, "no Renaming" should only switch off the behavior if it was off in the corresponding call to "use Exporter::Renaming". A future release may address this. SEE ALSO
Exporter, Perl AUTHOR
Anno Siegel, <siegel@zrz.tu-berlin.de> ACKNOWLEDGEMENTS
Thanks to Avi Finkel (avi@finkel.org) and Simon Cozens (simon@simon-cozens.org) for a discussion of this project on IRC. While brief, their remarks helped me think about things the right way. COPYRIGHT AND LICENSE
Copyright 2003 by Anno Siegel This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-04-23 Exporter::Renaming(3pm)
All times are GMT -4. The time now is 03:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy