Sponsored Content
Full Discussion: find command error
Top Forums Shell Programming and Scripting find command error Post 302643113 by mirni on Friday 18th of May 2012 12:30:28 PM
Old 05-18-2012
I believe it is because find is trying to descend into directory that no longer exists -- it was deleted with the exec call. Look at the output of find, it starts with the root dir, and descends deeper:
Code:
/path/to/dir
/path/to/dir/file1
/path/to/dir/file2
/path/to/dir/subdir
...

It forks a rm -r command but has no way of nowing that the rootdir has been deleted with this fork.

So what you need, is the -depth option, which processes the directory contents first:
Code:
find /var/log -depth -name  "test*"  -exec rm -r {} \;

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

I want to get the file which created the error when the find command was run

I want to get the file which created the error when the find command was run ? I am wrote a script to mail a list of files whose file size is ge than 0 and returns 0 but wen it finds a folder with only empty files it exits as 1. i need to modify it so that the return for this is also 0 (but it... (1 Reply)
Discussion started by: guhas
1 Replies

2. UNIX for Dummies Questions & Answers

find command exec error

Hi All, i am writing a shell script in korn shell which deletes all the files in a directory once in every 10DAYS. the directory has different format files. the script has something like this; cd /home/data/pavi echo "Please Enter the Number of Days to search for" read DAYS... (2 Replies)
Discussion started by: pavan_test
2 Replies

3. Shell Programming and Scripting

Perl Script Error with find command

Guys, I need to find all the files ending with either dmp or dmp.Z. This command is giving me error. @files =`find $path \(-name "*.dmp" -o -name "*.dmp.Z"\) -mtime +30`; sh: 0403-057 Syntax error at line 1 : `(' is not expected. Thanks in advance (4 Replies)
Discussion started by: MKNENI
4 Replies

4. Shell Programming and Scripting

Find Command in the script throw error

Hi I have script that is developed to serch for 30 days old Directory & Files and then remove them ... when i run it successfully removes the Directory & files & but it throw errors on the screen .. .. + find . -type f -mtime +30 -exec rm -f {} ; + exit please help me ?? I... (0 Replies)
Discussion started by: Beginner123
0 Replies

5. UNIX for Advanced & Expert Users

find command error

Executing "find /abc -follow -ls" the message "find: cycle detected for /abc/def/ghi/ What does this mean? Thanks... (2 Replies)
Discussion started by: twk
2 Replies

6. Shell Programming and Scripting

ksh - find command with 2 actions attached and error logging

Hi there, I'm encountering problems on an AIX system when using following in my script. find . -name *.edi -type f -exec sh -c 'scp {} $user@$server:$path || exit 5; mv {} $sent || exit 7' \; the error i get is following find: 0652-018 An expression term lacks a required... (4 Replies)
Discussion started by: Kerberos
4 Replies

7. Shell Programming and Scripting

find command error

Hi, We have a shell script which looks into a directroy for any folder older than 30 days and removes them. The command being used is find $ARCHIVE_DIR -type d -mtime +$PURGE_HIST_DAYS -exec rm -rf {} \; It removes some folders but then throw below errors for others: find:... (2 Replies)
Discussion started by: DejaVu
2 Replies

8. Shell Programming and Scripting

Find command error having space in filename

Hi, I am working in solaris.I am using below script to copy the files from /usr/tmp to /usr/gm But while running this it is not considering the files list after the filename having space in them. Example:- compile_custom_pll.sh conv_data_sqlload.sh conv_sqlload.sh Copy of... (5 Replies)
Discussion started by: millan
5 Replies

9. Shell Programming and Scripting

find command -No such file error

Hi , I tried the below code to remove the files older that 30 days . #!/bin/ksh set -x file_path1="/home/etc" file_path2="/home/hst" file_nm="HST" days=30 find $file_path1/*$file_nm* -type f -mtime +$days -exec rm -f {} \; find $file_path2/*$file_nm* -type f -mtime +$days -exec rm... (3 Replies)
Discussion started by: smile689
3 Replies

10. UNIX for Beginners Questions & Answers

Find command giving bad status error

In a fastload teradata utility I am trying to delete the files which are older than 30days using the find and rm command as following. find . -name 'xxx_*' -mtime +30 -exec rm -f {} \; I expect it to delete all the files older than 30 days but sometimes it gives an error : find: bad status--... (3 Replies)
Discussion started by: stelkar
3 Replies
CPANPLUS::Internals::Utils(3perl)			 Perl Programmers Reference Guide			 CPANPLUS::Internals::Utils(3perl)

NAME
CPANPLUS::Internals::Utils - convenience functions for CPANPLUS SYNOPSIS
my $bool = $cb->_mkdir( dir => 'blah' ); my $bool = $cb->_chdir( dir => 'blah' ); my $bool = $cb->_rmdir( dir => 'blah' ); my $bool = $cb->_move( from => '/some/file', to => '/other/file' ); my $bool = $cb->_move( from => '/some/dir', to => '/other/dir' ); my $cont = $cb->_get_file_contents( file => '/path/to/file' ); my $version = $cb->_perl_version( perl => $^X ); DESCRIPTION
"CPANPLUS::Internals::Utils" holds a few convenience functions for CPANPLUS libraries. METHODS
$cb->_mkdir( dir => '/some/dir' ) "_mkdir" creates a full path to a directory. Returns true on success, false on failure. $cb->_chdir( dir => '/some/dir' ) "_chdir" changes directory to a dir. Returns true on success, false on failure. $cb->_rmdir( dir => '/some/dir' ); Removes a directory completely, even if it is non-empty. Returns true on success, false on failure. $cb->_perl_version ( perl => 'some/perl/binary' ); "_perl_version" returns the version of a certain perl binary. It does this by actually running a command. Returns the perl version on success and false on failure. $cb->_version_to_number( version => $version ); Returns a proper module version, or '0.0' if none was available. $cb->_whoami Returns the name of the subroutine you're currently in. _get_file_contents( file => $file ); Returns the contents of a file $cb->_move( from => $file|$dir, to => $target ); Moves a file or directory to the target. Returns true on success, false on failure. $cb->_copy( from => $file|$dir, to => $target ); Moves a file or directory to the target. Returns true on success, false on failure. $cb->_mode_plus_w( file => '/path/to/file' ); Sets the +w bit for the file. Returns true on success, false on failure. $uri = $cb->_host_to_uri( scheme => SCHEME, host => HOST, path => PATH ); Turns a CPANPLUS::Config style "host" entry into an URI string. Returns the uri on success, and false on failure $cb->_vcmp( VERSION, VERSION ); Normalizes the versions passed and does a '<=>' on them, returning the result. $cb->_home_dir Returns the user's homedir, or "cwd" if it could not be found $path = $cb->_safe_path( path => $path ); Returns a path that's safe to us on Win32 and VMS. Only cleans up the path on Win32 if the path exists. On VMS, it encodes dots to _ using "VMS::Filespec::vmsify" ($pkg, $version, $ext) = $cb->_split_package_string( package => PACKAGE_STRING ); Splits the name of a CPAN package string up into its package, version and extension parts. For example, "Foo-Bar-1.2.tar.gz" would return the following parts: Package: Foo-Bar Version: 1.2 Extension: tar.gz perl v5.14.2 2014-09-29 CPANPLUS::Internals::Utils(3perl)
All times are GMT -4. The time now is 09:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy