Shell or Perl Scripts
Hi,
I am to new to scripting and I have a urgent requirement that I should do. The requirement is. A shell script that reads a directory and its sub directories and generate a flat file or csv file at the end so that I can use that file to load data into my tables. Please very urgent. Thanks in Advance |
how about just typing "find /path/to/directory >files.txt"?
|
Quote:
find $1 -print >> filestruct.csv The $1 would allow you to give a top level directory. Now you will need to refine that a bit to remove the filenames that come up. |
Hi,
I do not have the script yet, I need to create a new one from scratch. So need help regarding this. |
Ok, do you want a list of the files or of their contents? You just got suggestions for both...
|
Hi,
I just need to read the info from the file like the file names, no.of files in that directory type of files in that directory.. |
Quote:
if you are wanting to find just the directory structure you could do the following Code:
find . -type d > myTree.csv for getting a list of all files then you could do the following Code:
find . -type f > myTreeFile.csv |
All these answers to your homework question. This may help: How to Create a First Shell Script
|
Quote:
Code:
#! /bin/bash --- rod. |
NewUser_28:
We are not here to do your homework for you. If you want to work in the computer field, you need to do the work yourself. That means spending time researching, reading, trying different things and making lots of mistakes from which you learn. That is what we have done. We volunteer our time on forums to help newbiew and each other. Don't just come here and ask us to do your assignments. Think about something, your instructor most likely reads these forums also and likely will be wise to your methods. Tom |
You also never explained what the problem really is!
If you at least want a chance of us helping, you must post the exact specs of the output file to the last detail, because we can't read your mind. |
Sorry but i'm giving him a script.
Code:
#!/bin/bash |
All times are GMT -5. The time now is 11:39 AM. |