Sponsored Content
Top Forums Shell Programming and Scripting runnning a shell script in multiple folders Post 302317432 by melearlin on Tuesday 19th of May 2009 02:36:23 AM
Old 05-19-2009
Thanks, this is exactly what I was looking for.

edit: This is the current state of my code, and it almost does what I'm looking for--how can I make the loop exclude the root directory companies? I only want this to happen in the immediate subfolders.

Code:
cd companies
find . -type d -print |
while read dirname 
do
  cd $dirname
  if [ -f "changes.txt" ]; then
     #some code
  else
      #some other code
  fi
  cd -
done


Last edited by melearlin; 05-20-2009 at 02:20 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

moving multiple folders/files in subversion using bash script

Hi, I'm new here an dlearning a lot from this forum. i didnt find any solution for this in the forum. I have already checked in folders in subversion named HTT01,... HTT21.. and have files in each folder like below: HTT01/HTT01_00000.hex HTT01/HTT01_00000_fb_result.hex... (2 Replies)
Discussion started by: ravishan21
2 Replies

2. Shell Programming and Scripting

Shell script to check if any file exists in 4 folders

Hi All, working on AIX 5.3. Requirement is: Shell script in ksh to check if any file exists in 4 folders as below: 1. /FILE/INB/INT1 2. /FILE/INB/INT2 3. /FILE/INB/INT3 4. /FILE/INB/INT4 Thanks a lot for your time! a1_win. (3 Replies)
Discussion started by: a1_win
3 Replies

3. Shell Programming and Scripting

Display runnning countdown in a bash script?

I am looking for a way to display on a single line, a running countdown for a given amount of time in a terminal using a bash script. I am looking for this to use as part of a larger bash script that captures Video. The script sets up a bunch of parameters for DVgrab, and one of the parameters... (11 Replies)
Discussion started by: Starcast
11 Replies

4. Shell Programming and Scripting

Shell script to move files to 3 different folders

Hi guys: I've got this problem, I want to move a bunch of files to 3 different folders, without any specific order, and I'm trying to automatize it with a shell script. I'm a newbie at shell scripting so this is my first try: #!/bin/bash COUNTER=`ls -1 | wc -l` while do ARRAY=(... (11 Replies)
Discussion started by: wretchedmike
11 Replies

5. Shell Programming and Scripting

Shell script to arrange files into several folders

Hello this is the script Im working on I have a picture collection that I rescued from a hard drive and there are thousands of pictures saved in one folder. What I need is to create several folders and put lets say around 200 pictures in each folder. At the end instead of having one huge... (8 Replies)
Discussion started by: kizofilax
8 Replies

6. Shell Programming and Scripting

fixperms on folders in shell script

Hi, I am using fixperms command to change permissions of diretories in my script, i have to change 3 directories permissions one by one using fixperms. i tried the below code code: exec DIR1/fixperms -rRy DIR1 exec DIR2/fixperms -rRy DIR2 exec DIR3/fixperms -rRy DIR3 but this is... (4 Replies)
Discussion started by: sreelu
4 Replies

7. Shell Programming and Scripting

Urgent- shell script to create sub folders

Hi All, Could any one help me with a shell script which will create different sub folders in a folder and of which the sub folders names should be taken from a text file. Thanks (1 Reply)
Discussion started by: chetansingh23
1 Replies

8. Shell Programming and Scripting

automating a shell script to run across all the folders

I would like to know how to automate an already made shell script (all the steps of all the commands done on a specific folder) by utilizing a list (a .txt) of all folder names that the shell scripts goes and executes For example: In the working folder called main/ there are subfolders named... (3 Replies)
Discussion started by: Lucky Ali
3 Replies

9. Shell Programming and Scripting

Shell Script to delete files within a particular time frame under multiple sub folders

Greetings! I'm looking for starting information for a shell script. Here's my scenario: I have multiple folders(100) for example: /www/test/applications/app1/logs /www/test/applications/app2/logs Within these folders there are log files files that need to be deleted after a month. ... (3 Replies)
Discussion started by: whysolucky
3 Replies

10. Shell Programming and Scripting

Script to move files in multiple folders

Hello all, I would appreciate any help to write a script. I have folder A which contains over 30 thousands xml files, I would like create multiple folders and move those files (500 in each folders). Thank you (1 Reply)
Discussion started by: mmsiddig
1 Replies
efi_mkdir(1M)															     efi_mkdir(1M)

NAME
efi_mkdir - make an EFI directory SYNOPSIS
devicefile] dirname DESCRIPTION
makes an EFI directory. The EFI file system is based on the FAT file system and used by the Itanium-based system BIOS to locate an HP-UX bootloader. See efi(4). creates directory dirname in the EFI volume specified by devicefile. If dirname already exists, exits with a diagnostic message, and the directory is not changed. If more than one subdirectory needs to be created to make dirname, exits with a diagnostic message and the directory is not changed, unless the option is specified. dirname should be relative to the root of the EFI volume specified by device- file, not to an HP-UX file system. Options Options can be used singly or combined in any order before the file names. The space between option and argument is optional. devicefile is the device special file of the EFI file system where the directory is to be made. Without the option, uses the device file specified in the environment variable if it is defined. The option overrides the environment variable. Create intermediate directories as necessary. RETURN VALUE
returns exit code 0 if the directory is made successfully. Otherwise it prints a diagnostic message and returns nonzero. 0 Successful completion. >0 Error condition occurred. EXAMPLES
Create directory in device file which contains an EFI file system: Create a directory in device file which contains an EFI file system, when does not exist yet: Create a directory in persistent device file (see intro(7)), which contains an EFI file system, when does not exist yet: AUTHOR
was developed by HP. SEE ALSO
efi_cp(1M), efi_fsinit(1M), efi_ls(1M), efi_rm(1M), efi_rmdir(1M), efi(4), intro(7). Itanium(R)-based Systems Only efi_mkdir(1M)
All times are GMT -4. The time now is 10:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy