The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Listing subdirectories and files senthil_is Shell Programming and Scripting 1 05-24-2008 07:38 AM
du (exclude files) the_learner UNIX for Advanced & Expert Users 1 07-17-2007 02:06 PM
list largest files in a directory & its subdirectories igidttam UNIX for Dummies Questions & Answers 6 09-25-2006 11:31 AM
How to exclude files from printed results umen UNIX for Dummies Questions & Answers 2 09-18-2005 06:35 AM
tar: how to exclude subdirectories? kymberm Filesystems, Disks and Memory 7 10-15-2002 03:53 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-16-2008
shyjuezy shyjuezy is offline
Registered User
  
 

Join Date: May 2008
Posts: 9
Question list the files but exclude the files in subdirectories

If I execute the command "ls -l /export/home/abcde/dev/proj/code/* | awk -F' ' '{print $9}' | cut -d'/' -f6-8" it will list all the files in /export/home/abcde/dev/proj/code/ directory as well as the files in subdirectories also
proj/code/test.sh
proj/code/test1.c
proj/code/unix
proj/code/xml_db


CPP: SUBDIRECTORY
a.out
constr.cpp
fn_ptr.cpp
samp.cpp


MYSCRIPTS: SUBDIRECTORY
autoTest.sh
file2.txt
filenames.txt
filenames.txt


Is there any way to list only the files mentioned in path /export/home/abcde/dev/proj/code/ and should exclude all the files in subdirectories CPP and MYSCRIPTS
proj/code/test.sh
proj/code/test1.c
proj/code/unix
proj/code/xml_db

Thanks in advance...
  #2 (permalink)  
Old 05-16-2008
fabtagon fabtagon is offline
Registered User
  
 

Join Date: Apr 2008
Location: European Union/Germany
Posts: 189
i) ls -ld
ii) find -maxdepth 1 -type f
  #3 (permalink)  
Old 05-16-2008
shyjuezy shyjuezy is offline
Registered User
  
 

Join Date: May 2008
Posts: 9
Thanks fabtagon
ls -ld worked for me...
  #4 (permalink)  
Old 10-15-2008
tosattam tosattam is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 13
ls -l d do not work for me

Hi i want to list only the files within a directory and not the sub directories if any. i tried ls -ld but that is not working for me.
this is the result if I use it in usr/bin
$ pwd
/usr/bin
$ ls -ld
drwxr-xr-x 4 bin bin 40960 Mar 17 2008 .
$
  #5 (permalink)  
Old 10-15-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,847
What shell you are using (exact version, if possible)?
  #6 (permalink)  
Old 10-15-2008
tosattam tosattam is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 13
I am using K shell but how do I know the version??

$ echo $0
-ksh

Last edited by tosattam; 10-15-2008 at 07:26 AM..
  #7 (permalink)  
Old 10-15-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,847
OK,
you may try:

Code:
print $KSH_VERSION
It will return the release of the mksh and pdksh (if I recall correctly).

Otherwise you may try:

Code:
print ${.sh.version}
and it works with ksh93 (that's the most powerful implementation).

If none of the above works, you probably have ksh88 (^V to display its version).

Anyway, I suppose fpmurphy will offer a more succinct solution with ksh93, meanwhile you may try:

Code:
find /usr/bin/* ! -name . -prune -type f -ls
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:07 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0