10-20-2009
You have a couple of options, though neither is as nice as maxdepth:
-xdev Prevents the find command from traversing a file system different from the one specified by the Path parameter.
-prune Stops the descent of the current path name if it is a directory.
Cheers,
Keith
8 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi, I am using Solaris 5.8
I searched online, the find command has an option called maxdepth which can be used to limit the number of directories find will look into.
find . -maxdepth 2 -type f
When I run the above command in solaris, I get an error
find: bad option -maxdepth
find:... (2 Replies)
Discussion started by: Leion
2 Replies
2. UNIX for Dummies Questions & Answers
Hi
I wish to find only files in dir /srv/container/content/imz06/. It means exclude subfolder /srv/container/content/imz06/archive/
> uname -a
SunOS testbox6 5.10 Generic_139555-08 sun4v sparc SUNW,Sun-Blade-T6320Its Solaris default "find"
> find /srv/container/content/imz06/* -name... (4 Replies)
Discussion started by: slashdotweenie
4 Replies
3. AIX
Using nimadm:
nimadm -j nimadmvg -c sap024 -s spot_6100 -l lpp_6100 -d "hdisk1" -Y
Initializing the NIM master.
Initializing NIM client sap024.
0505-205 nimadm: The level of bos.alt_disk_install.rte installed in SPOT
spot_6100 (6.1.3.4) does not match the NIM master's level (7.1.1.2).... (2 Replies)
Discussion started by: sciacca75
2 Replies
4. UNIX for Dummies Questions & Answers
find /full/path/dir \( ! -name dir -o -type f \) -prune -type f
on AIX it worked perfect :
sdp1:/var/tmp/test# find /var/tmp/test/ \( ! -name test -o -type f \) -prune \
-name "*properties" -type f -exec ls -l {} \; -exec cksum {} \;
-rw------- 1 root system 19 Dec 12... (5 Replies)
Discussion started by: laxmikant.hcl
5 Replies
5. AIX
Hello,
I've set up email alerts on AIX Servers. so that i can get email notifications (via mail relay server) when ever there is abnormal behavior.
for example
1) my script monitors CPU/disk/memory etc... when it reaches high water ark, it will send an email alert.
2) disk usage alerts
3)... (5 Replies)
Discussion started by: System Admin 77
5 Replies
6. Shell Programming and Scripting
Hi All,
I am trying to select 30 days older files under current directory ,but not from subdirectory using below command.
find <Dir> -type f -mtime + 30
This command selecting all the files from current directory and also from sub directory .
I read some documention through internet ,... (1 Reply)
Discussion started by: kommineni
1 Replies
7. Shell Programming and Scripting
Can you please figure out what is the issue here
$ find . -maxdepth 1 -type f -size 0 -print
find: bad option -maxdepth
please find the OS details
$ uname -a
HP-UX g5u1216 B.11.31 U ia64 2614088426 unlimited-user license
Use code tags, thanks. (6 Replies)
Discussion started by: TomG
6 Replies
8. Shell Programming and Scripting
Have you tried running the command below? On the same RHEl 6.8 or 6.6. It will give you different output.
find . -maxdepth 1 -ctime -7 -type f
rpm -qa|grep find
findutils-4.4.2-9.el6.x86_64
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.8 (Santiago)
# (6 Replies)
Discussion started by: invinzin21
6 Replies
LEARN ABOUT LINUX
dpkg::path
Dpkg::Path(3) libdpkg-perl Dpkg::Path(3)
NAME
Dpkg::Path - some common path handling functions
DESCRIPTION
It provides some functions to handle various path.
METHODS
get_pkg_root_dir($file)
This function will scan upwards the hierarchy of directory to find out the directory which contains the "DEBIAN" sub-directory and
it will return its path. This directory is the root directory of a package being built.
If no DEBIAN subdirectory is found, it will return undef.
relative_to_pkg_root($file)
Returns the filename relative to get_pkg_root_dir($file).
guess_pkg_root_dir($file)
This function tries to guess the root directory of the package build tree. It will first use get_pkg_root_dir(), but it will
fallback to a more imprecise check: namely it will use the parent directory that is a sub-directory of the debian directory.
It can still return undef if a file outside of the debian sub-directory is provided.
check_files_are_the_same($file1, $file2, $resolve_symlink)
This function verifies that both files are the same by checking that the device numbers and the inode numbers returned by
stat()/lstat() are the same. If $resolve_symlink is true then stat() is used, otherwise lstat() is used.
canonpath($file)
This function returns a cleaned path. It simplifies double //, and remove /./ and /../ intelligently. For /../ it simplifies the
path only if the previous element is not a symlink. Thus it should only be used on real filenames.
$newpath = resolve_symlink($symlink)
Return the filename of the file pointed by the symlink. The new name is canonicalized by canonpath().
my $cmdpath = find_command($command)
Return the path of the command if available on an absolute or relative path or on the $PATH, undef otherwise.
my $control_file = get_control_path($pkg, $filetype)
Return the path of the control file of type $filetype for the given package.
my @control_files = get_control_path($pkg)
Return the path of all available control files for the given package.
AUTHOR
Raphael Hertzog <hertzog@debian.org>.
1.16.0.3 2012-04-17 Dpkg::Path(3)