![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Find Files in a Directory Excluding Subdirectories | Amol_Dicholkar | UNIX for Dummies Questions & Answers | 2 | 12-11-2008 07:54 AM |
| How to remove directory with subdirectories and files? | ppa108 | UNIX for Dummies Questions & Answers | 9 | 11-25-2008 02:02 AM |
| search files in a directory and its subdirectories | Net-Man | Shell Programming and Scripting | 1 | 09-04-2008 09:25 PM |
| Shell:Find a word in files in a directory and subdirectories | yeclota | Shell Programming and Scripting | 4 | 08-29-2008 05:05 AM |
| Find all files created by a specified user in a directory and its subdirectories | abhilashnair | UNIX for Dummies Questions & Answers | 5 | 06-13-2007 02:37 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
to parse a directory and its subdirectories and find owner name of files
hi all,
i need to capture all the files in a directory and its subdirectories that have owner name different than the root owner. for one file it is " stat -c %U filename " but i need to search for each and every file and record it. thanks in advance |
|
||||
|
if you have Python
Code:
#!/usr/bin/env python
import os,stat
for r,d,f in os.walk(os.path.join("/home","path","path2") ):
for files in f:
filepath=os.path.join(r,files)
owner=os.stat(filepath)[stat.ST_UID]
if owner!=0:
print filepath
|
|
||||
|
yes. File::Find
|
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|