Find the owner user of each folder in a list


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Find the owner user of each folder in a list
# 1  
Old 10-30-2018
Find the owner user of each folder in a list

Hello

I have a file containing the list of different folders like this file_list.txt:

Code:
/s8/tests/test1
/s8/tests/tests/test2
/s8/tests/test2
/s8/tests/tests/test2/test5

I want a script to put the owner user of each folder in front of it in the text file.

So the reult would become like this file_list_users.txt:

Code:
/s8/tests/test1 user1
/s8/tests/tests/test2 user2
/s8/tests/test2 user1
/s8/tests/tests/test2/test5 user3


Last edited by Johanni; 10-30-2018 at 11:56 AM..
# 2  
Old 10-30-2018
look into ls -ld
# 3  
Old 10-30-2018
Quote:
Originally Posted by vgersh99
look into ls -ld
that is correct but how could i put the owner user of each folder in front of each folder path in the text file?
# 4  
Old 10-30-2018
Hi,

Have you tried anything, let us know if you have.

You can create a loop with your file as input, then using cut or awk capture what you require to an output file.

I'm going to point you at this post where someone has already pretty much answered the question for you.

Regards

Gull04

Last edited by vgersh99; 10-30-2018 at 12:42 PM.. Reason: post of a wrong thread
# 5  
Old 10-30-2018
Are you on Linux? If so you should have the stat command. See man stat for other % options.

Code:
stat -c '%n %U' folder1 folder2 folder3

This User Gave Thanks to Corona688 For This Post:
# 6  
Old 10-30-2018
Hi,

The command is also available on Solaris 11 and Solaris 10 if the contributed S/W was installed.

Regards

Gull04
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Windows & DOS: Issues & Discussions

User OS to intall the Oracle (owner)

hello its windows server 2003 how to find the user owner to install the oracle on linux ps -fea | grep pmon $ps -fea| grep pmon oracle 2950 1 0 Sep 13 ? 262:19 ora_pmon_db1 oracle 741 19102 0 17:32:47 pts/5 0:00 grep pmon:confused: the user its... (0 Replies)
Discussion started by: ceciaide
0 Replies

2. Shell Programming and Scripting

Shell script that lists files with different owner than the folder

Hello, I'm trying to write a script which is listing files based on different preferences, like filetype or permissions. All is fine, except for one: I want to list files in /home which has a different owner than the home directory it is in. Here is an example: /home/UserA is the directory, and... (10 Replies)
Discussion started by: Zwiebi
10 Replies

3. Shell Programming and Scripting

How to find DL Owner info using ldapsearch?

Currently i have following syntax: ldapsearch -D "CN=..,OU=..,OU=All Businesses,DC=..,DC=..,DC=.." -w .. -h .. -p .. -b "OU=All Businesses,DC=..,DC=..,DC=.." "managedObjects=$DL_NAME_CN" employeeNumber givenName sn -S employeeNumber -x which gives me following info: "requesting:... (0 Replies)
Discussion started by: arsenghani
0 Replies

4. Shell Programming and Scripting

Find folder within folder, then find other folder in same dir

Hi all I'm new to your forum but not new to shells. I'm having a little trouble though as it's been quite some time since I scripted. Here's what I'm trying to do: I'm trying to search a directory named '/var/root/Applications' for another directory 'fooBar'. The "Applications" directory... (9 Replies)
Discussion started by: DC Slick
9 Replies

5. UNIX for Advanced & Expert Users

command to find the owner of a db

Hi, Im working with an Informix db, i would like to know the command to identify the owner of a particular database Thanks (2 Replies)
Discussion started by: dvah
2 Replies

6. Shell Programming and Scripting

Find user owner of the most recently file in the system

Good evening everybody, I have to find the user owner of the most recently file in the system How can I do? :confused: (5 Replies)
Discussion started by: Guccio
5 Replies

7. Shell Programming and Scripting

Find all text files in folder and then copy to a new folder

Hi all, *I use Uwin and Cygwin emulator. I´m trying to search for all text files in the current folder (C/Files) and its sub folders using find -depth -name "*.txt" The above command worked for me, but now I would like to copy all found text files to a new folder (C/Files/Text) with ... (4 Replies)
Discussion started by: cgkmal
4 Replies

8. Shell Programming and Scripting

find files by OWNER

i have written a script in which i have to go to a dir and search there for files belonging to owner pipe and then delete them Can anyone tell me how to find files by owner pipe. below some of the files belonging to owner pipe -rw------- 1 pipe pipe 163840 Mar 18 2008 ... (7 Replies)
Discussion started by: ali560045
7 Replies

9. UNIX for Dummies Questions & Answers

Find files by owner

Hello, I have a problem, I need to find files in folder by owner, not using find command at all and ls -R parameter. Thanx a lot. Best regarts (1 Reply)
Discussion started by: Boliakas
1 Replies

10. UNIX for Dummies Questions & Answers

su - user... how to find out the list of users and their passwords..

hi, to do a su - user, we need to know what are the users... so in unix 1) which file to see the list of users, passwords? (2 Replies)
Discussion started by: yls177
2 Replies
Login or Register to Ask a Question