How to send a file in batch mode ?
C#
3
Posts
2
Posters
0
Views
1
Watching
-
How do we send a file in batch mode to a computer in the same network?
Luck is Opportunity with hardwork
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
//source target paths
string targetComputerPath = "//myServer/myShare/";
string sourceComputerPath = "c:/test/";//build up a list of files ArrayList myFiles = new ArrayList(); myFiles.Add("file1.txt"); myFiles.Add("file2.txt"); myFiles.Add("file3.txt"); //send each one foreach (string fileName in myFiles) { string target = targetComputerPath + fileName; string source = sourceComputerPath + fileName; System.IO.File.Copy(source , target); } } }
}
and then there's error handling to think of...
Regards Malc *********************************************
-
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
//source target paths
string targetComputerPath = "//myServer/myShare/";
string sourceComputerPath = "c:/test/";//build up a list of files ArrayList myFiles = new ArrayList(); myFiles.Add("file1.txt"); myFiles.Add("file2.txt"); myFiles.Add("file3.txt"); //send each one foreach (string fileName in myFiles) { string target = targetComputerPath + fileName; string source = sourceComputerPath + fileName; System.IO.File.Copy(source , target); } } }
}
and then there's error handling to think of...
Regards Malc *********************************************