[EMAIL PROTECTED] wrote:
> Is it possible , with the find command on linux, to avoid the recursively
> directory hierarchy ?
Find is not a textutil command. Find has its own mailing list. But I
think I can answer your question anyway.
> So, i would, for example, remove the file "*.bat" in a directory , but not
> in the recursive directory
>
> My structure directory is :
> /my_dir/
> /my_dir/recurse_dir/
>
> this command works, but all the sub directorys are concerned
> => find /my_dir -name "*.bat" -exec rm {} \;
Find is recusive by nature. For your example you probably just want
to use 'rm' directly.
rm *.bat
But 'find' can control the recursion depth. These next two options
are probably what you are looking for.
- Option: -maxdepth levels
Descend at most LEVELS (a non-negative integer) levels of
directories below the command line arguments. `-maxdepth 0' means
only apply the tests and actions to the command line arguments.
- Option: -mindepth levels
Do not apply any tests or actions at levels less than LEVELS (a
non-negative integer). `-mindepth 1' means process all files
except the command line arguments.
You probably wanted to use:
find /my_dir -maxdepth 1 -name "*.bat" -exec rm {} \;
Using find with xargs is more efficient.
find /my_dir -maxdepth 1 -name "*.bat" -print0 | xargs -r0 rm
Bob
_______________________________________________
Bug-textutils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-textutils