473,770 Members | 4,522 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 996
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.GetFile s("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*****@optonl ine.net"

msg.From = "be*****@cherwe llinc.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\visua l basic notes.doc"

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

msg.Cc = "we*******@cher wellinc.com"

SmtpMail.SmtpSe rver = "smtp.registere dsite.com"

Try

SmtpMail.Send(m sg)

Catch ex As Exception

MessageBox.Show (ex.Message)

End Try

HTH,

Bernie Yaeger

"Max Bialystock" <ca******@legs. com> wrote in message
news:uP******** *****@tk2msftng p13.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
7775
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 ---------------------------------------------------------------------------- ----------------- import re, os, time, shutil os.chdir(os.environ+os.environ+"\\Desktop") DESKTOP = os.listdir(os.environ+os.environ+"\\Desktop")
1
2359
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 when double clicked on, it will only run when I use Access to open it as a file. If I create the file in Folder B, it works, I can double click on it I can do what I like, I move it to Folder A, and it will not run unless selected open file...
1
1444
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 never actually moved code onto a real web hosting company, so everything is all new to me. Some of the questions I have which hopefully someone will be able to point me in the right direction.... 1. How do I alter my connection string for my MDB...
2
12420
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 email server an email from one of our vendors to which is attached a text file (a comma-delimited data file containing the details of our monthly
1
4777
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 Visual Basic Script file, call it "Move and Reformat Text File.VBS," that will run from a Windows Script Host command-prompt-based version as follows: C:\> Cscript.exe "Move and Reformat Text File.VBS" The objective of the VBScript file, "Move...
1
1370
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 appears in. i.e. Move File 4 into Folder A from File B by checking the box and hitting the Move to Folder A button. here is what I have so far.<html> <head> </head> <body> <form id="file_mover"> <TABLE BORDER=5 CELLPADDING=10 CELLSPACING=10...
4
1671
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 a new folder which suppose to be move the files on that folder i have 3 problems: 1. is how to get last access time of the FILE and put it column2 of the listview 2. i want to view that are unused icon and document last week, 2weeks, 1month...
4
3271
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 creating each file, it moves the file to folder B, using shutil.move(). Thread T2, takes files from folder B and processes it. Note: Only the thread T1 has access to the files in folder A.
0
1610
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 close Outlook Express. I then copy the file (using Windows File Manager aka Exploring) to my desktop computer. When I open Outlook Express on the desktop computer, it now has all the email in folder = Transfer, and I can move it to the correct...
0
9439
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10237
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10071
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10017
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9882
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8905
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6690
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3987
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 we have to send another system

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.