Find problem listing directories even -type f


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find problem listing directories even -type f
# 1  
Old 01-30-2009
Java Find problem listing directories even -type f

Hi All,

#!/bin/ksh
find /home/other -ls -type f -xdev | sort -nrk7 | head -2 >bigfile.txt


The above is my script, which writes the large file into a file called bigfile.txt. My script contains only the above two lines.
after execution i am getting the output like
find: cannot chdir to </home/usr/some> : Permission denied
find: cannot chdir to </home/usr/some1> : Permission denied
2 16 drwxrwxrwx 122 rampsys system 16384 Jan 30 04:00 /amex/ramp/usr_work
1980 8 drwx------ 3 svidwa sas 8192 Jan 28 11:03 /amex/ramp/usr_work/SAS_wo

First two lines are the directories to which i am not having access. ok
then see the next two which i am getting is also a directory, but in find command i has given - type f. Then why it is displaying directories.

My target is, have to display the largest files alone and that to be redirected to a file. Not a directory.
Please guide me.
# 2  
Old 01-30-2009
looks like it's barfing on the order of your find options

try :

Code:
find /home/other -type f -ls -xdev | sort -nrk7 | head -2 >bigfile.txt

i.e. swap the -type f and the -ls switches
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

listing directories with more than x files

How can I find and print the directories on a server that have more than 5,000 files? There's some spam emails and I'm trying to find all directories that have a lot of spam The file count should just be the files directly under that directory, not like the total from all nested directories ... (1 Reply)
Discussion started by: vanessafan99
1 Replies

2. Shell Programming and Scripting

listing directories and sub directories with time and name options

Hello all! I'm looking to list directories and sub-directories of a path, on this forum I found this command: find $path -type d -exec ls -ld {} \; The issue I have is that with a simple ls, the list is listed by name, and using -t I get it by time. How could I list directories and sub... (5 Replies)
Discussion started by: nomadvisuals
5 Replies

3. UNIX for Advanced & Expert Users

find -type d returning files as well as directories

Can anyone see why the following command returns all files and not just the directories as specified? find . -type d -exec ls -F {} \; Also tried find . -type d -name "*" -exec ls -F {} \; find . -type d -name "*" -exec ls -F '{}' \; -print Always returns all files :-\ OS is... (2 Replies)
Discussion started by: tuns99
2 Replies

4. Shell Programming and Scripting

Listing non empty directories

Hi Gurus, How to list directories that are non-empty and non-hidden Thanks in advance (2 Replies)
Discussion started by: kinny
2 Replies

5. Shell Programming and Scripting

listing directories alone

ls lists all files and sub directories in the current directory but how to list only the sub directories and not the files? (2 Replies)
Discussion started by: bbala
2 Replies

6. UNIX for Dummies Questions & Answers

listing of directories with / at end...without ls -F

Hi When im listing (ls -al ) its listing directories without / at the end of directories dir1 dir2 dir3 and i need to list directories with dir1/ dir2/ dir3/ and this should not be made by command ls -F / should be embedded at the last since one of the scripts reads... (10 Replies)
Discussion started by: vasanthan
10 Replies

7. UNIX for Advanced & Expert Users

listing of directories with / ...not to use ls -F

Hi When im listing (ls -al ) its listing directories without / at the end of directories dir1 dir2 dir3 and i need to list directories with dir1/ dir2/ dir3/ and this should not be made by command ls -F / should be embedded at the last since one of the scripts reads directories... (1 Reply)
Discussion started by: vasanthan
1 Replies

8. UNIX for Dummies Questions & Answers

Listing Unique directories.

Hi, Simple question. If i could find a file been listed in many dirctories, how to get the unique list of directories. find / -name "abc*" --> will give me list of directories. /home/abc.txt /home/ddd/abcd.txt /home/ddd/abcde/txt So how to get /home /home/ddd Thanks in... (2 Replies)
Discussion started by: deepakwins
2 Replies

9. UNIX for Dummies Questions & Answers

Listing directories and ${1:+$1/}*

Hi I have 2 questions: Q1 - What does ${1:+$1/}* mean? I guess it lists all files in current directory - Could any one explain how this expression works? Q2 - I am trying to list directories only in current path - I know that ls could be used but I thought I'd give find a try. I need to... (5 Replies)
Discussion started by: GMMike
5 Replies

10. UNIX for Dummies Questions & Answers

files and directories listing

Hello: I need to list some files into some directories ordered by size. i need help! BEst regards Alberto (1 Reply)
Discussion started by: bbolson
1 Replies
Login or Register to Ask a Question