bulrush
Thread Starter
- Joined
- Oct 14, 2011
- Messages
- 22
I have Sun Solaris 5.9 running C Shell. It seems that the Solaris version of find does not have all features of a POSIX find. So, it does not find files that begin with a period.
However, we have at least 1000 files that are backups of graphic files that need to be deleted, but I can't find an automated way to delete them. I'll have to do this every month or so. Plus we are running out of disk space, and do not have a budget to buy a new disk!
So, on Solaris, how can I find and remove all files that begin with "._"?
Thanks.
p.s. Solaris find also does not seem to traverse subdirs, even if I do use -depth.
I also made this script and found out that find does not traverse subdirs if a subdir is something other than ".". Here's my script:
This script has various ways of using find, but if I pass in a subdir name, like "mystuff", it will not find files, like *.bak, even if a .bak file exists under mystuff.
However, we have at least 1000 files that are backups of graphic files that need to be deleted, but I can't find an automated way to delete them. I'll have to do this every month or so. Plus we are running out of disk space, and do not have a budget to buy a new disk!
So, on Solaris, how can I find and remove all files that begin with "._"?
Thanks.
p.s. Solaris find also does not seem to traverse subdirs, even if I do use -depth.
I also made this script and found out that find does not traverse subdirs if a subdir is something other than ".". Here's my script:
Code:
#/bin/csh
# Nov 2011
# Find files from current and all subdirs.
if ($#argv<2) then
echo "Updated: Nov 30, 2011"
echo "Usage: $0 startdir filespec"
echo "Example: $0 mydir *.bak"
echo " Find all files matching filespec recursively. "
exit 1;
endif
if !(-d $argv[1]) then
echo "Input dir $argv[1] does not exist, or it's not a dir."
echo " "
exit 1;
endif
#set mydir=`pwd`
set startdir=$argv[1]
set filespec=$argv[2]
echo "Looking for $startdir $filespec"
#find $startdir -name "$filespec" -print -exec rm {} ';'
#find $argv[1] \( -name "$filespec" \) -exec echo {} ';'
find $startdir -name "$filespec" -print
#find $startdir -name "$filespec" -print | xargs rm -f
echo "Done finding files."