Sending Multipes files as attachents in directory


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
Sending Multipes files as attachents in directory

When i run the below command in Unix it works

Code:
echo|mailx -s "Subject"   $( printf -- '-a %q ' /Directory/*.* )  mail_address < /directory/mail_body.txt


But when the same command is run in AIX Platform I get invalid -a error.


Could you please help on this


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 03-15-2019 at 12:25 PM.. Reason: Added CODE tags.
# 2  
What Unix? What shell?

What does man mailx say on either system?

Last edited by RudiC; 03-15-2019 at 12:51 PM..
# 3  
we dont have the option for -a on on the platforms in the man for mailx.

Do we have any workaround to send multiples files in a directorty :

I have tried below but it doesnt attach files

Code:
(
   for i in /dir/*.*
   do 
      uuencode "$i" $(basename "$i") ;  
   done
) | mailx -s "Subject" mail_addrr < /dir/Mail_Body.txt


Code:
Flags

       Flags Description
       Item
            Description
       -c Address(es)
            Specifies the list of users to which a copy of the message is sent. You can specify one or more addresses. When specifying more than one address, the list of addresses must be in (" ") quotes.
       -d
            Specifies the debug information associated with the users mailbox
              *    uid
              *    user name
              *    mail file folder (the system mailbox)
              *    dead letter (the system saves incomplete messages in the dead.letter file in the $HOME
              *    mbox  (the personal mailbox)
            Note: The message is not sent when the program is in the debug mode.
       -e
            Tests for the presence of mail in the system mailbox. The mail utility will write nothing and exit with a successful return code if there is mail to read.
       -f FileName
            Reads messages from the named file. If a file operand is not specified, then reads messages from mbox. When you quit from reading the messages, undeleted messages are written back to this file.

Code:
The following options are accepted:

       -A name
              Executes an account command (see below) for name after the startup files have been read.

       -a file
              Attach the given file to the message.

       -B     Make standard input and standard output line-buffered.

       -b address
              Send blind carbon copies to list.  List should be a comma-separated list of names.

       -c address
              Send carbon copies to list of users.

       -D     Start in disconnected mode; see the description for the disconnected variable option.

       -d     Enables debugging messages and disables the actual delivery of messages.  Unlike -v, this option is intended for mailx development only.

       -e     Just check if mail is present in the system mailbox.  If yes, return an exit status of zero, else, a non-zero value.

       -E     If  an  outgoing message does not contain any text in its first or only message part, do not send it but discard it silently, effectively setting the skipemptybody variable at program startup.  This
              is useful for sending messages from scripts started by cron(8).

       -f [file]
              Read in the contents of the user's mbox (or the specified file) for processing; when mailx is quit, it writes undeleted messages back to this file.  The string file is handled as described  for  the
              folder command below.


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 03-15-2019 at 01:03 PM.. Reason: Added CODE tags.
# 4  
Any Inputs
# 5  
Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Directory containing files,Print names of the files in the directory that are exactly same content.

Given a directory containing say a few thousand files, please output a list of all the names of the files in the directory that are exactly the same, i.e. have the same contents. func(a_directory_name) output -> {“matches”: , … ]} e.g. func(“/home/my/files”) where the directory... (7 Replies)
Discussion started by: anuragpgtgerman
7 Replies

2. Shell Programming and Scripting

List files with date, create directory, move to the created directory

Hi all, i have a folder, with tons of files containing as following, on /my/folder/jobs/ some_name_2016-01-17-22-38-58_some name_0_0.zip.done some_name_2016-01-17-22-40-30_some name_0_0.zip.done some_name_2016-01-17-22-48-50_some name_0_0.zip.done and these can be lots of similar files,... (6 Replies)
Discussion started by: charli1
6 Replies

3. Programming

GFORTRAN sending .o files in separate directory

I am using gfortran and want to send .o files in separate directory. Currently I have the following in a bash script. The .mod files are handled ok, but the .o files are still created in the same directory as the source code fsrc="newunit.f08 math.f08 tString.f08 prout.f08 prary.f08... (1 Reply)
Discussion started by: kristinu
1 Replies

4. Shell Programming and Scripting

Grepping file names, comparing them to a directory of files, and moving them into a new directory

got it figured out :) (1 Reply)
Discussion started by: sHockz
1 Replies

5. Shell Programming and Scripting

Sending email with multiple files..

Hello,, I am loading data into the 4 tables from 4 different input files. The data gets loaded, and the e-mail is also sent to the user, but the log files for all the 4 files is not been sent.. I am trying to send e-mail to users with the log file as attachment. The script is as follows:... (30 Replies)
Discussion started by: msrahman
30 Replies

6. Shell Programming and Scripting

script to monitor files in a directory and sending the alert

Hi All, We are having important config files in an directory which was accessable by all /auto/config/Testbed/>ls config1.intial config2.intial config3.inital often we find that some of the lines are missing in config files, we doubt if some one is removing. I would like to write... (0 Replies)
Discussion started by: shellscripter
0 Replies

7. Shell Programming and Scripting

Sending an email with more than one files

Hi, I would like to send an email with more than one attachement. I am using uuencode. I want to achive by suing uuencode. Also please let me know other ways. -Thambi (7 Replies)
Discussion started by: thambi
7 Replies

8. How do I send email?

sending files as attachments

How do I send a file as an attachment on a Unix system (9 Replies)
Discussion started by: SmartJuniorUnix
9 Replies

9. UNIX for Dummies Questions & Answers

sending files as attachments

How do I send a file as an attachment on a Unix system (9 Replies)
Discussion started by: SmartJuniorUnix
9 Replies

Featured Tech Videos