Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Getting all file names in a folder. Post 3308 by adadevil on Thursday 28th of June 2001 02:49:23 PM
Old 06-28-2001
Wonderful.

Quite not all, but your code gave me enough idea to implement this. Following is what I have done and its working great.

Thanks a lot for your help.

For your thinking about using cut, well I used awk as its easier and will give me complete field regardless of its size.
Code:
#!/bin/ksh

strPath=`echo "/app70s/d001/staging/Test/BadFiles/"$1`

for file in `ls -l $strPath | grep -v drwx | awk '{print $9}'`
do
   echo ":" $file
   intCount=`wc $strPath/$file | awk '{print $1}'`
   if [ $intCount != 0 ]
     then
       echo $file " contains bad records. Rows are failing." | mailx -s "Session Failed" mail.address@mail.server.com;
   fi
done

added code tags for readability --oombera

Last edited by oombera; 02-19-2004 at 10:27 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Working with folder names

I have the following directory structure: /maindir /maindir/product1/ /maindir/product1/type1 /maindir/product1/type2 /maindir/product1/type3 /maindir/product2/ /maindir/product2/type1 /maindir/product2/type2 /maindir/product2/type3 /maindir/product2/type4 ... I'm able to traverse... (6 Replies)
Discussion started by: ricksj
6 Replies

2. Shell Programming and Scripting

Script to move files with similar names to folder

I have in directory /media/AUDIO/WAVE many .mp3 files with names like: my filename_01of02.mp3 my filename_02of02.mp3 Your File_01of06.mp3 Your File_02of06.mp3 etc.... In the same directory, /media/AUDIO/WAVE, I have many folders with names like 9780743579490 9780743579491 etc.. Inside... (7 Replies)
Discussion started by: glev2005
7 Replies

3. Shell Programming and Scripting

editing names of files in multiple folder

I have 1000's of directories which is named as numbers. Each directory contains multiple files. Each of these directories have a file named "att". I need to rename all the att files by adding the directory name followed by "_" then att for each of the directories. Directories 120 att... (2 Replies)
Discussion started by: Lucky Ali
2 Replies

4. Shell Programming and Scripting

Renaming File Names in a folder/Dir

Hi Team, I'm new to Unix shell scripting . I've the following requirement A folder contains the list of files with the following format ab.name.11.first ab.name.12.second ab.name.13.third ---------- I have to rename the above file to like below ... (6 Replies)
Discussion started by: smile689
6 Replies

5. Shell Programming and Scripting

Bash script for printing folder names and their sizes

Good day, everyone! I'm very new to bash scripting. Our teacher gave us a task to create a script that basically does the same job the 'du' command does, with the difference that 'du' command gives an output in the form of <size> <folder name>and what we need is <folder name> <size>As for... (1 Reply)
Discussion started by: UncleIS
1 Replies

6. Homework & Coursework Questions

Bash script for printing folder names and their sizes

1. The problem statement, all variables and given/known data: The task is to create a script that would reproduce the output of 'du' command, but in a different way: what 'du' does is: <size> <folder name>and what is needed is <folder name> <size>We need to show only 10 folders which are the... (3 Replies)
Discussion started by: UncleIS
3 Replies

7. Shell Programming and Scripting

Remove trailing space from file and folder names

I have a folder that contains many sub folders and files. This tree has to be backed up to an archive system. According to the tech support, one of the archives is failing to back up due to the possibility of trailing spaces on file and folder names. Therefore, I would like to have a script... (16 Replies)
Discussion started by: vipertech
16 Replies

8. Shell Programming and Scripting

Checking Multiple File existance in a UNIX folder(Note: File names are all different)

HI Guys, I have some 8 files with different name and extensions. I need to check if they are present in a specific folder or not and also want that script to show me which all are not present. I can write if condition for each file but from a developer perspective , i feel that is not a good... (3 Replies)
Discussion started by: shankarpanda003
3 Replies

9. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 Replies

10. Shell Programming and Scripting

Script to tar/rsync/rm multiple folder names

hi all, i attach a link with what im trying to do automatically via script but i have some questions i need answering please, bear in mind i am really new to bash scripting, the only thing i know how to do is commands in scripts like cd rm tar rsync cp stuff like that i have mutiple project... (48 Replies)
Discussion started by: robertkwild
48 Replies
comp(1) 						      General Commands Manual							   comp(1)

NAME
comp - compose a message (only available within the message handling system, mh) SYNOPSIS
comp [msg] [+folder] [options] OPTIONS
Specifies the folder in which the draft message is created. If you do not send the draft, it is stored in this folder. This option is usually set up in your See mh_profile(4) for more information. If you have this option set up, you can override it by using the -nodraftfolder option. Specifies the name of a file in which a draft message is created. If no absolute pathname is given, this file is assumed to be in your Mail directory. If the file already exists, the mail system will ask you what you want to do with its contents before the draft message is created. If the named file does not contain a message header, the -draftmessage option does not create one. If you want to create a message in an empty file, use the -file option. You cannot use -draftmessage to specify a file name with the -draftfolder option. Specifies the editor used to create the draft message. The default editor is prompter; see prompter(1). You can specify any approved editor as an alternative. If you regularly use the same editor, you can specify it in the Editor: line of your entry sets up vi as the editor you use to com- pose mail messages: Editor: /usr/ucb/vi Uses the named file to create the draft message in. If no absolute pathname is given, the file is assumed to be in your Mail directory. If the file already exists, the mail system will ask you what you want to do with its contents before the draft is created. Unlike the -draftmessage option, this option creates a message header for a new draft. This means that you can create a draft in an empty file and send it successfully. Specifies an alternative mail header for your draft. The named form-file contains a message header, which comp uses when it creates the draft message. If no absolute pathname is given, it is assumed that the file is in your Mail directory. If you do not specify the -form option, comp takes the message header from the components file in your Mail directory, or, if this does not exist, it uses the system default header. You cannot use the -form option with either a +folder or a msgs argument. Prints a list of the valid options for this command. Creates a draft without invoking an editor. You are placed immediately at the What now? prompt, without being given the opportunity to edit the draft at all. This option is only useful if you are sending an existing draft using the -use option to comp. Otherwise it will produce a draft with no addresses and no content. Uses an existing draft as the new draft message. If you have saved a pre- vious unsent draft in a drafts folder or in the draft file, you can edit and send it using the -use option. The previous draft is displayed on your screen and the editor is invoked to allow you to edit the draft. When you exit from the editor, you receive the What now? prompt in the usual way. If you have a draft folder set up, or specify one with the -draftfolder option, the mail system will use the current draft in that folder as the new draft message. If you do not have a draft folder, it will use the contents of the draft file. If you do not want to use the current message in a folder, you can supply a message number. You can also use a message in a file by giving the file name using the -file or the -draftmessage options. If you want to send an existing draft without editing it further, you can supply the -use option in conjunction with the -noedit option. This will place you at the What now? prompt without invoking an editor. Specifies an alternative whatnow program. Nor- mally, comp invokes the default whatnow program. See whatnow(1) for a discussion of available options. You can specify your own alternative to the default program using the -whatnowproc program option. If you do specify your own program, you should not call it whatnow. You can suppress the whatnow program entirely by using the -nowhatnowproc option. However, as the program normally starts the ini- tial edit, the -nowhatnowproc option will prevent you from editing the message. The defaults for comp are: +foldername defaults to the current folder msg defaults to the current message -nodraftfolder -nouse DESCRIPTION
Use comp to create a new message for mailing. When you run comp, it provides a message template for you to fill in and invokes an editor so that you can complete the message. The comp command normally creates the new message in your draft folder, if you have one set up, or in the draft file if you do not have a draft folder set up. If you wish to use an existing message as the basis of your new draft message, you can use the msg or +folder argu- ments. The +folder argument takes the current message in the named folder as the basis of the new draft message. The msg argument takes the named message from your draft folder, or if you do not have a draft folder set up, from your current folder. In both cases, the mail system asks you what you want to do with the existing message. You cannot use the msg and +folder arguments together. A mail message consists of a mail header and the body of the message. The mail header contains all the information that determines who is going to receive the mail message. It can also give the recipients some information about the sender. The body of the message is the actual text of the message that you want to send. The header is separated from the body of the text by a blank line or by a line of dashes. The header must be separated from the body of the message in this way for the message to be identified properly when it is sent; see send(1). The standard message header looks like this: To: cc: Subject: -------- You can specify an alternative mail header by setting up a file called components in your Mail directory. This is used instead of the default mail header by comp. If you do not have a draft folder set up, comp creates your new draft in a file called draft in your Mail directory. This file must be empty before you can create a new draft, which means that you can only store one draft at a time. If it is not empty, the mail system will ask you what you want to do with the existing contents. The options are: Aborts comp, leaving the draft intact. Replaces the existing draft with the appropriate message form. Allows you to edit the existing draft. Displays the draft message. Refiles the existing draft message in the specified folder, and provides a new message form for you to complete. If you want to have more than one draft at a time, you can set up a draft folder in your keep as many unsent drafts as space allows, and still create new messages as you wish. To do this, make sure that the following line is in your Draft-folder: +drafts For more information on how to do this, see mh_profile(4). If you set up a draft folder, all draft messages are created in that folder. If you decide not to send the draft, by typing quit at the What now? prompt, the message is stored in the draft folder. You can then re-edit the message, or send it at a later date, by using the -use option to comp. PROFILE COMPONENTS
Path: To determine your Mail directory Draft-Folder: To find the default draft folder Editor: To override the default editor Msg-Protect: To set mode when creating a new message (draft) fileproc: Program to refile the message whatnowproc: Program to ask the "What now?" questions FILES
The default system template for draft messages. The user-supplied alternative to the default draft template. Your user profile. The draft file. SEE ALSO
dist(1), forw(1), prompter(1), repl(1), send(1), whatnow(1), mh_profile(4) comp(1)
All times are GMT -4. The time now is 02:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy