Loop over certain user directories and find files


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Loop over certain user directories and find files
# 1  
Old 12-23-2014
Loop over certain user directories and find files

Hello

I have user directories that contain /temp directory.

Example folders:
/user1/temp/
/user2/temp/
/user3/temp/

How can i loop over all user directories and find all files only in their /temp folder?


Thanks a lot for help!
# 2  
Old 12-23-2014
Why use a loop?

Doesnt
Code:
ls -al /user*/temp/*

work?
# 3  
Old 12-23-2014
How about
Code:
ls -la */temp/*
-rw-rw-r-- 1 usr1 grp1 0 Dez 23 11:59 user1/temp/xx
-rw-rw-r-- 1 usr1 grp1 0 Dez 23 11:59 user1/temp/yy
-rw-rw-r-- 1 usr1 grp1 0 Dez 23 11:59 user2/temp/xx
-rw-rw-r-- 1 usr1 grp1 0 Dez 23 11:59 user3/temp/xx

# 4  
Old 12-23-2014
wow, thank you for replies. Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Move several files into specific directories with a loop

Hello, I'm a first time poster looking for help in scripting a task in my daily routine. I am new in unix but i am attracted to its use as a mac user. Bear with me... I have several files (20) that I manually drag via the mouse into several named directories over a network. I've used rsync... (14 Replies)
Discussion started by: SonnyClark
14 Replies

2. AIX

find command to list all the 777 files and directories owned by root user

Hi I'm logged in to an AIX box now and we need to do an audit on this box. cbssapr01:# pwd / Which command will show all the files and directories owned by root user with permissions as 777 ? (8 Replies)
Discussion started by: newtoaixos
8 Replies

3. UNIX for Dummies Questions & Answers

find directories owned by a given user

Hi, I want to know if the is a way I can list the directories owned by a given user. Say i am logged in as that user. I found out the find command lists the files owned by a certain user/group but i want to know only the directories and if possible the permissions associated with these... (6 Replies)
Discussion started by: poojabhat
6 Replies

4. Shell Programming and Scripting

Find the total size of all directories that are owned by a particular User

Hi All, I am writing a script in which i need find the total size of all the directories that are present in a directory which are owned by a particular user. I will explain in details i have a dir DIR1 in which i have 5 dir's DIRA DIRB DIRC DIRD DIRE. DIRA DIRC DIRE are owned by "eswar" i... (2 Replies)
Discussion started by: firestar
2 Replies

5. UNIX for Dummies Questions & Answers

Loop through Sub Directories and search for set of files

I have the below directory in unix environment /home/bkup/daily: ls -lrt drwxrwx--x 2 user user 256 Jan 12 18:21 20110112/ drwxrwx--x 2 user user 256 Jan 13 17:06 20110113/ drwxrwx--x 2 user user 256 Jan 14 16:44 20110114/ drwxrwx--x 2 user user ... (2 Replies)
Discussion started by: prasannarajesh
2 Replies

6. Shell Programming and Scripting

Loop to move files in different directories

Hi, I have various log files in different paths. e.g. a/b/c/d/e/server.log a/b/c/d/f/server.log a/b/c/d/g/server.log a/b/c/h/e/server.log a/b/c/h/f/server.log a/b/c/h/g/server.log a/b/c/i/e/server.log a/b/c/i/e/server.log a/b/c/i/e/server.log and above these have an archive folder... (6 Replies)
Discussion started by: acc01
6 Replies

7. UNIX for Dummies Questions & Answers

How to find out in which directories a user can write?

Hi everybody, what command can show me the directories in which a certain user can write to? Kind Regards FranzB (2 Replies)
Discussion started by: FranzB
2 Replies

8. Shell Programming and Scripting

How to loop through directories to touch files

Hi, Please help me on this. Suppose i have the following directory structure. /app/data /app/data/eng /app/data/med /app/data/bsc each of the directories data,data/eng,data/med,data/bsc holds files with date extension like a.20081230 b.20081230 and so on I need a script to loop... (9 Replies)
Discussion started by: sussane
9 Replies

9. Shell Programming and Scripting

Script to loop through all files and directories.

I'm trying to write a script that will loop through all files and directories down from a path I give it, and change the permissions and ACL. I was able to do the obvious way and change the files and folders on the same level as teh path...but I need it to continue on deeper into the file... (2 Replies)
Discussion started by: cheetobandito
2 Replies
Login or Register to Ask a Question