473,509 Members | 2,671 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

email first file in a folder then move the file

Is it possible to take the first file in a folder (as sorted by name), email
it to someone, then move the file to a separate directory?

Any help at all will be much appreciated.

Thanks,
Max

Nov 20 '05 #1
1 986
Hi Max,

Sorry I didn't see your post until now.

The answer is yes, of course.

You'll want to start something like this:
Dim dirinfo As New DirectoryInfo("h:\tavo\vwsales\")

Dim finfo As FileInfo() = dirinfo.GetFiles("vw*.dbf")

Dim finfo_ As FileInfo

Dim larraylist As New ArrayList

For Each finfo_ In finfo

larraylist.Add(finfo_.Name)

Next

Then you can sort it, get the name of the first item, send it in an email as
an attachment, and then delete it. The email part: begin by using an
imports statement at the top of the module (above the class):

Imports System.Web.Mail

Then, in perhaps the click event of the button that will launch this:

Dim msg As New MailMessage()

msg.To = "be*****@optonline.net"

msg.From = "be*****@cherwellinc.com"

msg.Subject = "test subject"

msg.Body = "this is the test info"

Dim astring1 As String = "c:\my documents\wzo letter.doc"

msg.Attachments.Add(New MailAttachment(astring1))

Dim astring2 As String = "c:\my documents\visual basic notes.doc"

msg.Attachments.Add(New MailAttachment(astring2))

msg.Cc = "we*******@cherwellinc.com"

SmtpMail.SmtpServer = "smtp.registeredsite.com"

Try

SmtpMail.Send(msg)

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

HTH,

Bernie Yaeger

"Max Bialystock" <ca******@legs.com> wrote in message
news:uP*************@tk2msftngp13.phx.gbl...
Is it possible to take the first file in a folder (as sorted by name), email it to someone, then move the file to a separate directory?

Any help at all will be much appreciated.

Thanks,
Max

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7739
by: bmgz | last post by:
I am have made a simple script that moves all desktop clutter (ie files that are not *.lnk) to a specified folder eg. c:\myhome\mydocs\desktopdebris\2003-12-16 ...
1
2237
by: William Grace via AccessMonster.com | last post by:
I still have not had an answer to this, anyone with any ideas? I create an MBE in Folder A, it works in folder A, it works when I double click on it. if I move it to Folder B, it will not launch...
1
1432
by: Jim Heavey | last post by:
Hello, I have done some volunteer work for my club and develop a web site in ASP.Net. I have the code working fine and now I am ready to move the code up to their web hosting company. I have...
2
12410
by: Karen Grube | last post by:
Hi! I hate to bother you all with this, but I don't know how best to approach a particular task. Here's the deal: Once a month I receive in my own inbox on my company's Outlook Exchange...
1
4745
by: Osoccer | last post by:
...to a different folder and in the relocated file concatenates all of the lines in one long string with a space between each line element. Here is a fuller statement of the problem: I need a...
1
1361
by: bohn002 | last post by:
I am using php to display 2 folders contents in a dual pane form. Folder A and Folder B. I generate checkboxes next to each file, and want to use a submit button to change what folder the file...
4
1654
by: mikkoO8 | last post by:
hi. im actually making a desktop cleaner that can move the files and icons to a folder inside the listview box. i can make the listview box filled with files contains at the desktop and i can make...
4
3257
by: Roopesh | last post by:
Hi, I have a multithreaded application. There are two threads, T1 and T2. Suppose that there are two folders A, B. Thread T1 fetches data from network and creates files in folder A and after...
0
1598
by: OldBirdman | last post by:
For years I have transferred my email received on my laptop while traveling to my desktop. I have done this by using a Folder named Transfer. I move all mail I want to transfer to this folder and...
0
7233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7135
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7342
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7410
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7067
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7505
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5650
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.