![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 01:19 PM |
| getting full path from relative path | polypus | Shell Programming and Scripting | 4 | 03-25-2007 01: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 09:06 AM |
| Recursive directory listing without listing files | psingh | UNIX for Dummies Questions & Answers | 4 | 05-10-2002 11:52 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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. |
|
||||
|
Quote:
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 ? |
|
||||
|
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 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|