ls -lR


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ls -lR
# 1  
Old 01-07-2008
Question ls -lR

I have to create a script, in this script I have to list the files of a directory and of their subdirectories and then do other things...

So I thought to use:
ls -lR

But How can i remove the rows that I don't use?

For exemple:
/home/mirko/SetUpLinux3:
total 8
-rw-r--r-- 1 mirko mirko 1266 2007-12-25 18:59 C
-rw-r--r-- 1 mirko mirko 18 2007-12-16 00:03 Programmi Linux


I don't want:
/home/mirko/SetUpLinux3:
total 8
# 2  
Old 01-07-2008
something like this
Code:
ls -lR | awk '!/:$|[tT]otal/{print}'

# 3  
Old 01-07-2008
another option

ls |xargs -i ls -l {}|grep -v total
# 4  
Old 01-07-2008
You say you need to "do things" to the files, which to me means you'll need the full path to those files. Give this a shot:

Code:
find /path/to/your dir/ -type f | grep -v ~$

The grep will exclude any auto backup files ending in ~.

Hope this helps.....Cassj
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question