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
List files with full path mr_bold Shell Programming and Scripting 3 10-07-2008 12:19 PM
getting full path from relative path polypus Shell Programming and Scripting 4 03-25-2007 12:08 PM
list all files with full path of the file Sowser UNIX for Advanced & Expert Users 4 02-13-2007 05:46 PM
Full Directory Listing... B14speedfreak UNIX for Dummies Questions & Answers 5 05-11-2006 08:06 AM
Recursive directory listing without listing files psingh UNIX for Dummies Questions & Answers 4 05-10-2002 10:52 AM

Reply
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 08-02-2007
r_sethu r_sethu is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 12
Question Listing files with full path

Hi,

I need to store all the files in a directory to a text file with its full path.
The example below can explain:

./File1.txt
./File2.txt
./Folder1/File11.txt
./Folder1/File12.txt
./Folder1/Folder11/File111.txt
./Folder2/file21.txt
:
:

The ls -R1 command won't give the result as I desired. Please help.

Regards,
Sethu.
  #2 (permalink)  
Old 08-02-2007
vgersh99's Avatar
vgersh99 vgersh99 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,119
Code:
find . -type f | sed "s#^.#$(pwd)#"
  #3 (permalink)  
Old 08-02-2007
r_sethu r_sethu is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 12
Dear vgersh99,

Thanks a lot. It is working fine.

Is it possible to get the files ordered by Last modified date in the same pattern?

Thanks again for all.

Regards,
Sethu.
  #4 (permalink)  
Old 08-02-2007
congo congo is offline
Registered User
  
 

Join Date: Jun 2006
Posts: 31
Quote:
Originally Posted by r_sethu View Post

Is it possible to get the files ordered by Last modified date in the same pattern?

If you can use
Code:
ls -ltR yourpathandpipes
instead of `find` that might make you happy. You can then awk print the filename and append the sed pwd. Or run from another location onto the catalogue where files are placed, then ls should return fullpath.

Do you need hardcode examples ?
  #5 (permalink)  
Old 08-02-2007
r_sethu r_sethu is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 12
Hi Congo,

Thank you. It will be very useful for me if you could give one hardcoded example please.

Regards
Sethu.
  #6 (permalink)  
Old 06-15-2009
praving5 praving5 is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 4
Hi Guys,
I did something good today:

My situation:
-----------

I had 2 servers say server A and server B. Server A had got millions of files and directories. I had to keep the same ownership and group ownership in server B as in Server A. For this I did below:

1. Get to know the file ownerships in server A and put it in a file

find . -type f | sed "s#^.#$(pwd)#" | xargs ls -l | tr -s " " " " | cut -f3,4,9 -d\ > perm.conf

find . -type d | sed "s#^.#$(pwd)#" | xargs ls -ld | tr -s " " " " | cut -f3,4,9 -d\ >> perm.conf

2. copy the perm.conf on the server B under the same hierachy as in server A.

3. Then I wrote a script:

#!/bin/sh

k=`wc -l perm.conf | cut -f1 -d\ `
i=1
RECORD=""
OWNER=""
GROUP=""
FILE=""
while [ $k -ne $i ]
do
RECORD=`head -$i perm.conf | tail -1`
OWNER=`echo $RECORD | cut -f1 -d\ `
GROUP=`echo $RECORD | cut -f2 -d\ `
FILE=`echo $RECORD | cut -f3 -d\ `
chown $OWNER:$GROUP $FILE 2>> logfile
i=`expr $i + 1`
done

and I was done...

Hope this help someone...

Thanks and regards,
Pravin Goyal
Sponsored Links
Reply

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:33 PM.


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