listing folders and using in script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting listing folders and using in script
# 1  
Old 05-31-2007
listing folders and using in script

im a bit new to this and have been playing quite a bit and cant figure it out Smilie

I have made a basic script:

Code:
cd /folder/software1/bin/;
echo "software1," >> /in/local/var/trace/davescripts/software.txt  "\c";
ls -tm >> /in/local/var/trace/davescripts/software.txt;

and this basically repeats for software2, software3 and so on. However I need to run this on multiple boxes all with different software names so really want to be able to go into /folder/ (all software folders are in this folder) run a ls and then loop the rest using the output of ls.

Any ideas on how this can be done?
# 2  
Old 05-31-2007
ok new development lol

Code:
#!/bin/sh
for i in `cat /in/local/var/trace/davescripts/list.txt`
do
cd /service/$i/bin/;
echo $i >> /in/local/var/trace/davescripts/software.txt  "\c";
ls -tm >> /in/local/var/trace/davescripts/software.txt;
done

So now i'm putting a ls into a file called list.txt and trying it that way...it works Smilie

Last edited by truCido; 05-31-2007 at 08:17 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

[Solved] How to remove listing of current user cmd from ps -ef listing?

Hi All, Could you please help to resolve my following issues: Problem Description: Suppose my user name is "MI90". i.e. $USER = MI90 when i run below command, i get all the processes running on the system containing name MQ. ps -ef | grep MQ But sometimes it lists... (8 Replies)
Discussion started by: KDMishra
8 Replies

2. UNIX for Dummies Questions & Answers

Listing folders and files within

is there any command that can make listing files like this /data/seismic/prestack-4/eon5/PEP/JAWA/AKASIA-BAGUS/3D/F/BL3-4/F12AKB3D_SW82-128_ID1696-1850.segy /data/seismic/prestack-4/eon5/PEP/JAWA/AKASIA-BAGUS/3D/F/BL3-4/F12AKB3D_SW82-128_ID1851-1975.segy ... (2 Replies)
Discussion started by: muhnandap
2 Replies

3. Shell Programming and Scripting

Listing folders that have a file inside them

Hi guys, I'm new to the forums and putting my foot in the door with SED and AWK. I was wondering if someone could help me as I think I'm making this harder than it needs to be... I have a list of folders named as urls, inside these are log files and possibly a 'status' file. I'm trying to get... (6 Replies)
Discussion started by: KakersUK
6 Replies

4. UNIX for Dummies Questions & Answers

Searching for folders/parent folders not files.

Hello again, A little while back I got help with creating a command to search all directories and sub directories for files from daystart of day x. I'm wondering if there is a command that I've overlooked that may be able to search for / write folder names to an output file which ideally... (2 Replies)
Discussion started by: Aussiemick
2 Replies

5. Shell Programming and Scripting

Listing files script

hey guys I am writing a bash script that compares 2 directories and lists the contents that are different in each directory. I have figured out how to do this but the only problem is that it lists the file like this: -rw-r--r-- 1 joey12 users 0 2010-10-29 16:13 test/file3 I want it to print... (16 Replies)
Discussion started by: Joey12
16 Replies

6. Shell Programming and Scripting

AWK script for directory listing using GREP

Hi, All - script1.awk contains the following script: BEGIN { printf "The following are directory files:" "ls -l | grep '^d' | {print $0}" printf "There were "NR" directories in this list." } When I run the script, Here is what I get: $ awk -f... (4 Replies)
Discussion started by: ora_umair
4 Replies

7. Shell Programming and Scripting

Listing a directory via a script using variables

In my script I need to list the directory, where the generic name of the files will change, in my test case its set to TEST_*.mqsc. I wrote a small test script as below, but it just does not pip the listing to a file. Any idea why? dir='C:/cygwin/var/log/img/aut/' file=TEST01_*.mqsc ls $dir... (4 Replies)
Discussion started by: gugs
4 Replies

8. Shell Programming and Scripting

script needed for listing files

hi, i have a the direcories like usr\clone1\heap001.txt usr\clone2\heap334.txt usr\clone3\heap8899.txt i nead a command which list all the file starting with heap*.i have to execute the command from usr directory. find command is hanging, i need some other form of script to do ... (2 Replies)
Discussion started by: jayaramanit
2 Replies

9. Filesystems, Disks and Memory

Sun UNIX Files & Folders listing

Hi guys, i'm new to UNIX and only know a small amout about it, but have just had some changes at work which now require me to interact with and work on SUN Unix systems often. I have reasonable knowledge of PC's but hope that you will be able to help me with these questions. Part1. I would like... (3 Replies)
Discussion started by: Scrat
3 Replies

10. UNIX for Dummies Questions & Answers

Recursive directory listing without listing files

Does any one know how to get a recursive directory listing in long format (showing owner, group, permission etc) without listing the files contained in the directories. The following command also shows the files but I only want to see the directories. ls -lrtR * (4 Replies)
Discussion started by: psingh
4 Replies
Login or Register to Ask a Question