10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I am using aix. I would like to ignore the /u directory. I tried this but it is not working.
find / -type f -type d \( -path /u \) -prune -o -name '*rpm*' 2>/dev/null
/u/appx/ls.rpm
/u/arch/vim.rpm (4 Replies)
Discussion started by: cokedude
4 Replies
2. Shell Programming and Scripting
Hi
i am really new to linux scripting and i need a little bit help.
i have the following script:
find "/usr/share/nextcloud/data/__groupfolders" -type f -mtime +14 -exec rm {} \;
but i don't want to delete everything. I want to ignore .txt files. How can i do this? (3 Replies)
Discussion started by: Frederic
3 Replies
3. UNIX for Beginners Questions & Answers
Hi,
I am using following command to find a specific file.
find . -name "find*.txt" -type f -print
I am issuing that command at root directory since I don't know in which sub folder that file is getting created from some other process.
As I am not having access to all directories, my... (3 Replies)
Discussion started by: RameshCh
3 Replies
4. Shell Programming and Scripting
Dear All,
I am using find command
find /my_rep/*/RKYPROOF/*/*/WDM/HOME_INT/PWD_DATA -name rk*myguidelines*.pdf -print
The problem i am facing here is find /my_rep/*/
the directory after my_rep could be mice001, mice002 and mice001_PO, mice002_PO
i want to ignore mice***_PO directory... (3 Replies)
Discussion started by: yadavricky
3 Replies
5. HP-UX
Hi all
I wanted to change the home dir for a user, but when using smh :
SMH->Accounts for Users and Groups->Local Users->Modify User
----------------------------------------------------------------------------------------------------------------------------------------------
* Required... (8 Replies)
Discussion started by: fretagi
8 Replies
6. Shell Programming and Scripting
Hello,
I know find can be prevented from recursing into directories with something like the following...
find . -name .svn -prune -a type d
But how can I completely prevent directories of a certain name (.svn) from being displayed at all, the top level and the children?
I really... (2 Replies)
Discussion started by: nwb123
2 Replies
7. Shell Programming and Scripting
Dear Members,
I have a list of xml files like
abc.xml.table
prq.xml.table
...
..
.
in a txt file.
Now I have to search the file(s) in all directories and sub-directories and print the full path of file in a output txt file.
Please help me with the script or command to do so.
... (11 Replies)
Discussion started by: Yoodit
11 Replies
8. Shell Programming and Scripting
I want to find a dir called STOP from the root.so what is the find command.
Thanks & Regards
Rajkumar (1 Reply)
Discussion started by: rajkumar_g
1 Replies
9. Shell Programming and Scripting
Hello!!
I have directories from 2008, with files in them. I want to create a script that will find the directoried from 2008 (example directory:
drwxr-xr-x 2 isplan users 1024 Nov 21 2008 FILES_112108), delete the files within those directories and then delete the directories... (3 Replies)
Discussion started by: bigben1220
3 Replies
10. Programming
Hi,
I want to find whether a dir "temp" is present inside a dir. It should get a dir a input and search recursively within that directory to check whether temp is present and return 1 or return 0 if it is not present anywhere inside the directory/sub-directory. I know we can use readdir in the... (1 Reply)
Discussion started by: spsenthil
1 Replies
Wanted(3pm) User Contributed Perl Documentation Wanted(3pm)
NAME
File::Find::Wanted - More obvious wrapper around File::Find
VERSION
Version 1.00
SYNOPSIS
File::Find is a great module, except that it doesn't actually find anything. Its "find()" function walks a directory tree and calls a
callback function. Unfortunately, the callback function is deceptively called "wanted", which implies that it should return a boolean
saying whether you want the file. That's not how it works.
Most of the time you call "find()", you just want to build a list of files. There are other modules that do this for you, most notably
Richard Clamp's great File::Find::Rule, but in many cases, it's overkill, and you need to learn a new syntax.
With the "find_wanted" function, you supply a callback sub and a list of starting directories, but the sub actually should return a boolean
saying whether you want the file in your list or not.
To get a list of all files ending in .jpg:
my @files = find_wanted( sub { -f && /.jpg$/ }, $dir );
For a list of all directories that are not CVS or .svn:
my @files = find_wanted( sub { -d && !/^(CVS|.svn)$/ }, $dir ) );
It's easy, direct, and simple.
WHY DO THIS
?
The cynical may say "that's just the same as doing this":
my @files;
find( sub { push @files, $File::Find::name if -f && /.jpg$/ }, $dir );
Sure it is, but File::Find::Wanted makes it more obvious, and saves a line of code. That's worth it to me. I'd like it if find_wanted()
made its way into the File::Find distro, but for now, this will do.
FUNCTIONS
find_wanted( &wanted, @directories )
Descends through @directories, calling the wanted function as it finds each file. The function returns a list of all the files and
directories for which the wanted function returned a true value.
This is just a wrapper around "File::Find::find()". See File::Find for details on how to modify its behavior.
COPYRIGHT & LICENSE
Copyright 2005-2012 Andy Lester.
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0.
perl v5.14.2 2012-06-08 Wanted(3pm)