Searching for files and sending mail


Login or Register for Dates, Times and to Reply

 
Thread Tools Search this Thread
# 1  
Searching for files and sending mail

Hi,

I want a script that can perform the following tasks,

1)Open command prompt and navigate to certain path (for eg: C:\Programs\) and then execute the below command on a daily basis,
Code:
list -C <client name> -t 13 -l -R -s <previous_day> /D > D:\Prgrams\list_currentdate.txt

Note: There are 4 clients and the above command should be executed four times one time for each client , and the previous date should be calculated through some mean and passed on to that field (after -s in the command). The output is redirected to a folder with name list_currentdate.txt. And please note that only the underlined fields should only be changed and the rest of the fielss are constant in the command.

2) Mail the file to mail id. Please help me out.

Moderator's Comments:
Mod Comment Please use code tags next time for your code and data.

Last edited by vbe; 02-12-2013 at 08:42 AM..
# 2  
Not sure you are in the right forum, I will leave it here for a little while to see if it inspire anybody though
# 3  
just for the sake of getting previous date in MS-DOS , you can use Powershell provided by MS.
this command will give you Yesterday's date using PowerShell,

powershell -C $dte = Get-Date; echo $dte.AddDays(-1)

Else if you intend to use the pure native DOS capacities to generate a date (N-1) for you, you maay take a look at some of the google results which are again very different in execution and may take longer than required or may produce results differently.

For sending email from cmd line, try to use a configured MS-Outlook and then issue command line switches for sending email.

combining all these substitutes in in one single interpreter's file and then expecting it to return desired result will require a lot more troubleshooting .

VBS could do the same in more easy and generic way.

Regards,
Login or Register for Dates, Times and to Reply

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

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Sending Excel Files as attachment using Mail

Hie, I need to attach an .xlsx file as an attachment to a mail. I have used the mail option but i dont think there is anything for attachment. Can you show me how else can i do it? I am not allowed to install mutt since it is a workplace and they have their restrictions. And its a Bash Shell (2 Replies)
Discussion started by: barryallen
2 Replies

2. Red Hat

Problems sending mail: Difference between Mail and Mailx?

Whats the difference between mail and mailx? I'm trying to troubleshoot a problem where I can send mail from server A with this `echo $MESSAGE | mail -s "$SUBJECT" -r $FROM $RECIPIENTS` command but executing the same command from server B throws me this error (Both servers are RHEL) ... (1 Reply)
Discussion started by: RedSpyder
1 Replies

3. Shell Programming and Scripting

Searching for a particular mail and do something

I want a script which will searching for a particular mail and do something (1 Reply)
Discussion started by: bashamsc
1 Replies

4. UNIX for Dummies Questions & Answers

Sending mail

How can i send a mail when user login in unix ENV. How can i know present use mailID?? Moved out of Contact Us Forum - Please Do Not Post Technical Questions in Non-Technical Forum(s) (1 Reply)
Discussion started by: arun508.gatike
1 Replies

5. Shell Programming and Scripting

sending multiple files along with mail message using uuencode

Hi, I have a requirement to send a mail with multiple files attached to it and along with the text message in the mail. I am trying sumthing like below but it only sends me the text message and no files attached to the mail. ---------------------------------------- ( uuencode file1... (1 Reply)
Discussion started by: sachinkl
1 Replies

6. Shell Programming and Scripting

Stop sending mail after certain number of mail

Hi guys... I am busy writing a script to notify me via an mail if my application is down. I have done that. Now I want this script to stop sending mails after five mails were sent but the script should keep on checking the application. When the application is up again that count should be... (5 Replies)
Discussion started by: Phuti
5 Replies

7. Shell Programming and Scripting

Sending e-mail of record counts in 3 or more files

I am trying to load data into 3 tables simultaneously (which is working fine). Then when loaded, it should count the total number of records in all the 3 input files and send an e-mail to the user. The script is working fine, as far as loading all the 3 input files into the database tables, but... (3 Replies)
Discussion started by: msrahman
3 Replies

8. Shell Programming and Scripting

searching the name and sending mail

hi , i want to know how to do this.... i have a file in which an owner name and corresponding filename are written as shown below... owner filename abc /home/accounts/results/new.txt abc /home/accounts/results/new1.txt abc ... (1 Reply)
Discussion started by: vyasa
1 Replies

9. Ubuntu

help sending mail

Hi, I have kubuntu 8.10 and I would like to configure Ubuntu to can send mail from command line with mailx. I've saw that I need to install a MTA. But I don't know with install and how. Do you know some howto or url where I find how could I configure it? Many thanks and sorry for my... (2 Replies)
Discussion started by: mierdatuti
2 Replies

10. UNIX for Dummies Questions & Answers

sending a mail to a mail client

Hi everyone! I'm trying to create a database monitoring script that reads an alert file and sends an error message if it can 'grep' a particular string. Is there a way to send this message to a mail client using SMTP? Even better, is there any place on this site that has these kinds of... (5 Replies)
Discussion started by: solaris73
5 Replies

Featured Tech Videos