03-09-2009
Shell script for a writing the directory structure to a file
Hi All,
I am new user of shell scripting has come up with a problem. that I have a directory structure like :
Home
|
|--------A
| |----trunk
| |-------A_0_1/
| |
| |-------A_0_2/
|
|--------B
| |-----trunk
| |-------B_0_1/
| |
| |-------B_0_2/
|
|--------C
| |-----trunk
| |---------C_0_1/
My problem is to write a script that will generate a file reporting this file hierarchy i.e (The script can be run be from Home)
(Directiry structure states that under Home/ there are 3 subdirectories called A, B, C . Each has another subdirectory called trunk/, all trunk contains the versions of original directory like A_0_1, A_0_2, B_0_1...so on)
$ cat file
--------------
A/trunk/A_0_1
A/trunk/A_0_2
B/trunk/B_0_1
B/trunk/B_0_2
C/trunk/C_0_1
--------------
Please help me regarding this. Thanks in advance.
Last edited by bhaskar_m; 03-09-2009 at 02:02 AM..
Reason: to make the proper understanding of directory structure
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I'm a novice and I'd like to make a directory structure with a hundred or so folders. I've tried mkdir /foo/foo1/etc...
mkdir /foo/foo2/etc
mkdir /foo/foo3/etc
mkdir /foo/foo4/etc
...but it appends '@' to each folder name and then fails on the subdirectories. Is it better to use a... (2 Replies)
Discussion started by: kamur
2 Replies
2. UNIX for Advanced & Expert Users
Hi,
I am trying to write a script that will move all the files from source directory structure(multiple levels might exist) to destination directory structure. If a sub folder is source doesnot exist in destination then I have to skip and goto next level. I also need to delete the files in... (4 Replies)
Discussion started by: srmadab
4 Replies
3. UNIX for Dummies Questions & Answers
how would i write a shell script to count number of one-line comments in a c++ file. please help with coding thank you. (1 Reply)
Discussion started by: deadleg
1 Replies
4. Shell Programming and Scripting
Hello Folks,
I want to get the results from a SQL query which needs to be exported to a .txt file.
My Script is something like
#!/bin/ksh
db2 connect to DATABASE user user_name using pwd;
touch test.txt
isResult=0;
isResult= `db2 -x select 'ABC',COL_B from TABLE_A WHERE COL_B=CONDITION`... (6 Replies)
Discussion started by: dinesh1985
6 Replies
5. Shell Programming and Scripting
I am trying to prompt the user using tput command to read the information ( 5 last names, first names and grades) from the keyboard. Save the data in a file called student.txt. Sort the file by last name and display it on the screen
My pseudocode is as follow:
Pseudocode:
Initialize... (1 Reply)
Discussion started by: jestaton
1 Replies
6. Shell Programming and Scripting
Hi all,
I have a shell script which I use to login to the server from the client and then from the server I run a bunch of other scripts to complete my task. I am having problems with the script below-
#!/bin/bash
while read line
do
connections=`echo $line | cut -d " " -f 1`
period=`echo... (3 Replies)
Discussion started by: joydeep4u
3 Replies
7. Shell Programming and Scripting
Can we create the master file that show the whole tree structure of the directory till a particular folder?
Database that contains four sub repository Sybase,sql,oracle,mysql and sql and oracle contains two subrepostories Siebel and plsql and each repositories contains three folders... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies
8. Shell Programming and Scripting
Hi All,
I have a script that does daily checks on my storage environment and is run from an AIX host.
The script currently works great but I have been changing and updating bits of it to make it easier for my lesser colleagues to understand :p
However now with the updates I have made I... (1 Reply)
Discussion started by: colinwilson1303
1 Replies
9. Shell Programming and Scripting
Hi,
facing an issue while calling sqlplus inside shell script. It for some reason goes to tmp file to write something and i get error as permission denied as i dont have access there.
ANy idea why sqlplus writes in /tmp and how to change or stop this ? (2 Replies)
Discussion started by: rushikeshs
2 Replies
10. Shell Programming and Scripting
I need a script which should watch a directory for a file with specific directory.
If it finds a file in directory, it should search for few specific keyword in the file. if the keyword exists, it should trim string from specific column.
The file should be moved to another directory and the a... (8 Replies)
Discussion started by: akashdeepak
8 Replies