Hi This may be a small and good tip - instead of writing a shell script, which I was trying to find only files in the existing directory. And just thought of using the unix inbuilt command "find" to do this :-)
1.Find only Files in the existing dir:
find . -type f -name '*'
2.Find only Directory in the existing directory.
find . -type d -name '*'
3 find only symbolic links
find . -type l -name '*' 10:12:10
10:12:10 rsangvik@test100 $ ls -l
total 188
-rw-r--r-- 1 rsangvik users 65 Feb 29 10:12 an.pl
-rw-r--r-- 1 rsangvik users 138 Feb 29 12:23 apple
-rwxr-xr-x 1 rsangvik users 75 Feb 29 10:32 array.pl
-rwxr-xr-x 1 rsangvik users 181 Feb 23 15:48 break
-rwxr-xr-x 1 rsangvik users 216 Feb 16 15:03 com_output.sh
-rwxr-xr-x 1 rsangvik users 186 Feb 23 15:36 dater
-rwxr-xr-x 1 rsangvik users 276 Feb 29 10:28 default_scalar.pl
-rw-r--r-- 1 rsangvik users 784 Feb 29 11:32 echo
-rwxr-xr-x 1 rsangvik users 67 Feb 29 10:03 foreach.pl
-rwxr-xr-x 1 rsangvik users 151 Feb 29 09:32 if.pl
-rwxr-xr-x 1 rsangvik users 125 Feb 29 09:26 input.pl
-rw-r--r-- 1 rsangvik users 7001 Feb 29 11:56 mytestfile
-rwxr-xr-x 1 rsangvik users 87 Feb 29 15:32 num.pl
-rwxr-xr-x 1 rsangvik users 282 Feb 29 15:11 parse1.pl
-rwxr-xr-x 1 rsangvik users 224 Feb 29 11:52 parse.pl
-rwx------ 1 rsangvik users 113 Feb 13 16:16 passcrypt.pl
-rwxr-xr-x 1 rsangvik users 139 Feb 29 10:57 pop.pl
-rwxr-xr-x 1 rsangvik users 168 Feb 29 11:15 push.pl
-rwxr-xr-x 1 rsangvik users 241 Feb 29 15:02 regex.pl
lrwxrwxrwx 1 rsangvik users 6 Mar 1 10:06 soft -> num.pl
drwxr-xr-x 2 rsangvik users 4096 Mar 1 09:43 test
-rwxr-xr-x 1 rsangvik users 66 Feb 29 10:10 while.pl
-rw-r--r-- 1 rsangvik users 7001 Feb 29 11:56 yourtestfile
[~/script]
10:12:13 rsangvik@test100 $ find . -type f -name '*'
./parse1.pl
./com_output.sh
./num.pl
./foreach.pl
./an.pl
./parse.pl
./apple
./passcrypt.pl
./echo
./break
./push.pl
./yourtestfile
./pop.pl
./if.pl
./default_scalar.pl
./input.pl
./while.pl
./dater
./regex.pl
./mytestfile
./array.pl
[~/script]
10:12:19 rsangvik@test100 $ find . -type d -name '*'
./test
[~/script]
10:12:26 rsangvik@test100 $ find . -type l -name '*'
./soft
No comments:
Post a Comment