- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: How list unix files only excluding folders ?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2017 05:23 AM
02-24-2017 05:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2017 06:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2017 06:14 AM
02-24-2017 06:14 AM
Re: How list unix files only excluding folders ?
> How list unix files only excluding folders ?
Define "list". Which files?
mba$ ls -ld test*
-rwxr-xr-x 1 sms staff 8720 Aug 15 2015 test
-rw-r--r-- 1 sms staff 90 Aug 15 2015 test.c
drwxr-xr-x 3 sms staff 102 Aug 15 2015 test.dSYM
mba$ ls -ld test* | grep -v '^d'
-rwxr-xr-x 1 sms staff 8720 Aug 15 2015 test
-rw-r--r-- 1 sms staff 90 Aug 15 2015 test.c
mba$ find . -name 'test*'
./test
./test.c
./test.dSYM
./test.dSYM/Contents/Resources/DWARF/test
mba$ find . -name 'test*' ! -type d
./test
./test.c
./test.dSYM/Contents/Resources/DWARF/test
As usual, many things are possible, depending on exactly what you
want to do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2017 07:35 AM
02-24-2017 07:35 AM
Re: How list unix files only excluding folders ?
Hi,
thanks folks, very appreciated.
Both solution:
ls -1p | grep -v '.*/'
and
ls -ld test* | grep -v '^d'
Looks good.
I prefer the 1st.
Kind regards, Den.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 06:23 AM
02-27-2017 06:23 AM
Re: How list unix files only excluding folders ?
>>mba$ find . -name 'test*' ! -type d
Or there's always:
$ find . -type f
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2017 06:52 AM
02-27-2017 06:52 AM
Re: How list unix files only excluding folders ?
> >>mba$ find . -name 'test*' ! -type d
>
> Or there's always:
>
> $ find . -type f
It depends, of course, on whether we believe "files only" or
"excluding folders". In "man find", look for "-type", where one might
find more than two categories. For example:
[...] Possible file types are as follows:
b block special
c character special
d directory
f regular file
l symbolic link
p FIFO
s socket
> As usual, many things are possible, depending on exactly what you
> want to do.
Still true, I claim.