Sponsored Content
Top Forums Shell Programming and Scripting Script to loop through all files and directories. Post 302207298 by cheetobandito on Thursday 19th of June 2008 01:45:03 PM
Old 06-19-2008
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 structure. Is this possible?
 

10 More Discussions You Might Find Interesting

1. 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

2. Shell Programming and Scripting

AWK Script - Count Files In Directories

Hey, I'm very new to AWK and am trying to write a script that counts the number of files in all subdirectories. So, basically, my root has many subdirectories, and each subdirectory has many files. How can I get the total count? I haven't been able to figure out how to loop through the... (1 Reply)
Discussion started by: beefeater267
1 Replies

3. 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

4. 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

5. Shell Programming and Scripting

loop directories mv files to target in range

Hello, Currently I have a painstaking process that I use to move file for a monthly archive. I have to run the same two commands for 24 different directories. I wish to have a script with a for loop automate this and I have not been able to succeed. Here is what I do 24 times. I know this is... (5 Replies)
Discussion started by: jaysunn
5 Replies

6. Shell Programming and Scripting

Script to count number of files in directories

Hi All! I would like to have a script that will count the number of files at the top of the hour of soome directories and mail the results to me. I was thinking on : a=`/directory/subdirectory/ | wc -l` echo "/directory/subdirectory :$a" b=`/another_dir/subdir/ | wc -l` echo... (12 Replies)
Discussion started by: fretagi
12 Replies

7. Shell Programming and Scripting

Script to go Into Directories and Find/Delete files

I have a task, I usually do manually, but with growing responsibilities I tend to forget to do this weekly, I want to write a script that automates this, but I cant seem to work it out in my head, I have the shell of it out, but need help, and you guys have helped me with EVERY problem I have... (5 Replies)
Discussion started by: gkelly1117
5 Replies

8. Shell Programming and Scripting

Perl: script to work with files with the same name in different directories

Hi All, I would like to use a Perl (not Bash) script to work with multiple files of the same name in different directories (all in the same parent directory). I tried to create a loop to do so, but it isn't working. My code so far: while (defined(my $file = glob("./*/filename.txt")) or... (1 Reply)
Discussion started by: elgo4
1 Replies

9. UNIX for Dummies Questions & Answers

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! (3 Replies)
Discussion started by: flavius42
3 Replies

10. 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
FS_LISTACL(1)						       AFS Command Reference						     FS_LISTACL(1)

NAME
fs_listacl - Displays ACLs SYNOPSIS
fs listacl [-path <dir/file path>+] [-id] [-if] [-cmd] [-help] fs la [-p <dir/file path>+] [-id] [-if] [-cmd] [-h] fs lista [-p <dir/file path>+] [-id] [-if] [-cmd] [-h] DESCRIPTION
The fs listacl command displays the access control list (ACL) associated with each specified file, directory, or symbolic link. The specified element can reside in the DFS filespace if the issuer is using the AFS/DFS Migration Toolkit Protocol Translator to access DFS data (and DFS does implement per-file ACLs). To display the ACL of the current working directory, omit the -path argument. To alter an ACL, use the fs setacl command. To copy an ACL from one directory to another, use the fs copyacl command. To remove obsolete entries from an ACL, use the fs cleanacl command. CAUTIONS
Placing a user or group on the "Negative rights" section of the ACL does not guarantee denial of permissions, if the "Normal rights" section grants the permissions to members of the system:anyuser group. In that case, the user needs only to issue the unlog command to obtain the permissions granted to the system:anyuser group. OPTIONS
-path <dir/file path>+ Names each directory or file for which to display the ACL. For AFS files, the output displays the ACL from the file's parent directory; DFS files do have their own ACL. Incomplete pathnames are interpreted relative to the current working directory, which is also the default value if this argument is omitted. -id Displays the Initial Container ACL of each DFS directory. This argument is supported only on DFS directories accessed via the AFS/DFS Migration Toolkit Protocol Translator. -if Displays the Initial Object ACL of each DFS directory. This argument is supported only on DFS directories accessed via the AFS/DFS Migration Toolkit Protocol Translator. -cmd Outputs an fs setacl command string that can be used to recreate the ACL applied to the specified file, directory or symbolic link. -help Prints the online help for this command. All other valid options are ignored. OUTPUT
The first line of the output for each file, directory, or symbolic link reads as follows: Access list for <directory> is If the issuer used shorthand notation in the pathname, such as the period (".") to represent the current current directory, that notation sometimes appears instead of the full pathname of the directory. Next, the "Normal rights" header precedes a list of users and groups who are granted the indicated permissions, with one pairing of user or group and permissions on each line. If negative permissions have been assigned to any user or group, those entries follow a "Negative rights" header. The format of negative entries is the same as those on the "Normal rights" section of the ACL, but the user or group is denied rather than granted the indicated permissions. AFS does not implement per-file ACLs, so for a file the command displays the ACL on its directory. The output for a symbolic link displays the ACL that applies to its target file or directory, rather than the ACL on the directory that houses the symbolic link. The permissions for AFS enable the possessor to perform the indicated action: a (administer) Change the entries on the ACL. d (delete) Remove files and subdirectories from the directory or move them to other directories. i (insert) Add files or subdirectories to the directory by copying, moving or creating. k (lock) Set read locks or write locks on the files in the directory. l (lookup) List the files and subdirectories in the directory, stat the directory itself, and issue the fs listacl command to examine the directory's ACL. r (read) Read the contents of files in the directory; issue the "ls -l" command to stat the elements in the directory. w (write) Modify the contents of files in the directory, and issue the UNIX chmod command to change their mode bits A, B, C, D, E, F, G, H Have no default meaning to the AFS server processes, but are made available for applications to use in controlling access to the directory's contents in additional ways. The letters must be uppercase. For DFS files and directories, the permissions are similar, except that the DFS "x" (execute) permission replaces the AFS "l" (lookup) permission, DFS "c" (control) replaces AFS "a" (administer), and there is no DFS equivalent to the AFS "k" (lock) permission. The meanings of the various permissions also differ slightly, and DFS does not implement negative permissions. For a complete description of DFS permissions, see the DFS documentation. EXAMPLES
The following command displays the ACL on the home directory of the user "pat" (the current working directory), and on its "private" subdirectory. % fs listacl -path . private Access list for . is Normal rights: system:authuser rl pat rlidwka pat:friends rlid Negative rights: smith rlidwka Access list for private is Normal rights: pat rlidwka The following command generates the fs setacl command required to recreate the ACL on the home directory of the user "pat" (the current working directory), and on its "private" subdirectory. % fs listacl -path . private -cmd fs setacl -dir . -acl system:authuser rl pat rlidwka pat:friends rlid fs setacl -dir . -acl smith rlidwka -negative fs setacl -dir private -acl pat rlidwka PRIVILEGE REQUIRED
If the -path argument names an AFS directory, the issuer must have the "l" (lookup) permission on its ACL and the ACL for every directory that precedes it in the pathname. If the -path argument names an AFS file, the issuer must have the "l" (lookup) and "r" (read) permissions on the ACL of the file's directory, and the l permission on the ACL of each directory that precedes it in the pathname. If the -path argument names a DFS directory or file, the issuer must have the "x" (execute) permission on its ACL and on the ACL of each directory that precedes it in the pathname. SEE ALSO
fs_cleanacl(1), fs_copyacl(1), fs_setacl(1) COPYRIGHT
IBM Corporation 2000. <http://www.ibm.com/> All Rights Reserved. This documentation is covered by the IBM Public License Version 1.0. It was converted from HTML to POD by software written by Chas Williams and Russ Allbery, based on work by Alf Wachsmann and Elizabeth Cassell. OpenAFS 2012-03-26 FS_LISTACL(1)
All times are GMT -4. The time now is 03:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy