I would like to know how to list directories only without a / at the end. I would like to only see them in my current dir.
for example
ls - d */ gives
dir1/ dir2/ dir3/ dir4/
but is there a way to get only
dir1 dir2 dir3
I need to use it in this foreach loop:
the only problem is that not all the sub directories have a another dir inside them so when it gets to a dir that has no subdir it says that the dir "dirname/" does not exist. can anyone help.
thanks
for example
ls - d */ gives
dir1/ dir2/ dir3/ dir4/
but is there a way to get only
dir1 dir2 dir3
I need to use it in this foreach loop:
Code:
foreach x ( ` ls -d */ ` )
cd $x
set subdir = ` ls -F | grep -c '/$' `
@ subfiles = ` ls -F | wc -l ` - ` ls -F | grep -c '/$' `
echo " There are $subdir directories and $subfiles files in your $x directory. "
echo " "
end
the only problem is that not all the sub directories have a another dir inside them so when it gets to a dir that has no subdir it says that the dir "dirname/" does not exist. can anyone help.
thanks