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
ls command to list recursively ONLY subdirectories HLee1981 UNIX for Dummies Questions & Answers 5 05-14-2009 02:19 AM
list the files but exclude the files in subdirectories shyjuezy UNIX for Dummies Questions & Answers 8 10-15-2008 01:42 PM
Recursively changing permissions on files altamaha UNIX for Dummies Questions & Answers 1 03-01-2008 05:15 AM
Recursively copy only specific files from a directory tree sharpsharkrocks Shell Programming and Scripting 3 01-07-2008 02:16 PM
moving multiple files --recursively using BSD moxxx68 UNIX for Advanced & Expert Users 3 09-12-2005 07:41 AM

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 06-20-2002
roberthawke roberthawke is offline
Registered User
  
 

Join Date: May 2002
Location: Austria
Posts: 9
List Files Recursively

Hi!

I'd like to list my files recursively BUT:

I want them in this format, so that I can use them as options for commands like ftp->put or del

./directory1/file1.tar
./directory1/file2.tar
./directory1/file3.tar
./directory2/file1.tar
./directory2/file2.tar
./directory2/file3.tar
./directory2/file4.tar

Is there any option with ls or is there another command to do this??
  #2 (permalink)  
Old 06-20-2002
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
I beleive that you will need to use wildcards in your search portion of the ls statement.

As follows:

cd /

ls -la /*/* |awk '{ print $NF }' > /path/to/file # $NF will print the last field always so that you can get the filename intact with full path.


This will recursively list down 1 directory from the current directory. However, this will not do subsequent subdirectories. you will need to add a /* for each additional subdirectory and append that to the file you created with previous ls statements.

ls -la /* |awk ... > /path/to/file
ls -la /*/* | awk ... >> /path/to/file # append to first output.
ls -la /*/*/* | awk ... >> /path/to/file # and append again.
etc... ... ...


And the -a option will sort by alpha order as well. It will also pipe throught awk so that only the full path is listed and not file information.

There is another way but it does not show the full path.

ls -Rla |pg

This only shows a directory then the actual filename under that directory, not the full path as you requested.


  #3 (permalink)  
Old 06-20-2002
peter.herlihy peter.herlihy is offline
Registered User
  
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
Just use:

find . -name '*'

This will find all files from the point of execution downwards - and display the filepath and name from that same point.

You can change the fullstop (after find) to be any place in the filesystem....
  #4 (permalink)  
Old 06-21-2002
roberthawke roberthawke is offline
Registered User
  
 

Join Date: May 2002
Location: Austria
Posts: 9
I've got no idea, what the hell is up with that system, however pg and awk and find do not work. It only says:

bash: awk: command not found
bash: pg: command not found
bash: find: command not found

I'm not working on a local unix machine. I use SSH. Could it be that these commands are blocked for SSH??

Or do I probably run the wrong shell

By the way:

man doesn't work either!

Last edited by roberthawke; 06-21-2002 at 06:45 AM..
  #5 (permalink)  
Old 06-21-2002
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
A few questions.

Unless there are very restrictive, special settings, you should at least be able to use man and find. That is very strange indeed.


Are you root on this session or a normal user?
Is your PATH set to see those directories?


If you want to change your shell just type "ksh" at the prompt. Then type exit to quit the shell. You might check with the SA to see what the settings are for this system.
  #6 (permalink)  
Old 06-23-2002
peter.herlihy peter.herlihy is offline
Registered User
  
 

Join Date: Nov 2001
Location: New Zealand
Posts: 333
Quick check to see if they're inyour path...is "which find"

This will tell you where it is - if it's in your path. If it can't find it (which I suspect) then it's not in your path and needs to be added.
  #7 (permalink)  
Old 06-24-2002
roberthawke roberthawke is offline
Registered User
  
 

Join Date: May 2002
Location: Austria
Posts: 9
Oh man!!

typing "which find"
bash: which: command not found

typing "ksh"
bash: ksh: command not found

I got no clue!!
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 05:46 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