473,592 Members | 2,921 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

To search a file and copy it to server

7 New Member
I want to search a file from server and want to copy it to the local disk.
how it is done? This is working if the file is in my hard disk itself.But not when it comes to server. If i map the server i can search.like y:\\serverfolde \\folder am tring to make an exe. different people will map to different drive. so i cant give like that.should give like @\\server\\serv erfolde\\folder \\ but it is not working.
My code is<code>
searchfolder="y :\\Template\\el se";
destination ="D:\\Princy\\M y Documents\\proj ect\\";
string source=searchfo lder+"\\"+"mod5 01_"+filetosear ch+".3d";
string target=destinat ion+"mod501-"+filetosearch+ ".3d";
string[] files = Directory.GetFi les(searchfolde r, "mod501_"+filet osearch+".3d");
//string[] files = Directory.GetFi les(searchfolde r, filetosearch+"* ");
if(files.Length ==1)
{
foreach (string dir in files)
{
lblcnt.Text="Se lected File: "+ dir;
string[] search = Directory.GetFi les(destination ,"mod501-"+filetosearch+ ".3d");
if(search.Lengt h>0)
{
lblcnt.Visible= true;
lblcnt.Text="Fi le already exist";
}
else
{
File.Copy(sourc e,target);
lblcnt.Visible= true;
lblcnt.Text="Fi le copied";
}
}
</code>
what to give insted of
searchfolder="y :\\Template\\el se";

If am using
searchfolder="@ books\\template \\Template\\els e";
am geting error:
System.IO.Direc toryNotFoundExc eption:Could not find a part of the "@books\templat e\Template\els" .
Otherwise its working perfectly.
Sep 17 '07 #1
2 1962
epots9
1,351 Recognized Expert Top Contributor
i'm assuming this is C#, please post in the .Net Forums where the resident experts can better assist you.
Sep 17 '07 #2
princymg
7 New Member
File.copy(sourc e,target);
Sep 18 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
8713
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast, returned the hyperlinked page title, filename, and the body txt (30 preceding and following words) in context with the search word highlighted. Excellent.! See it working at: http://www.ipt.co.za Just search for "firearm"
1
2883
by: Luke Dalessandro | last post by:
I have an application where there is a primary XML data file. I'll use the following as an example: <data> <item id="a"> <name>A</name> <price>$10</price> </item> <item id="b"> <name>B</name>
3
4197
by: Alastair | last post by:
Hello guys, I've been building a search facility for an intranet site I'm part of developing and we've been building a search engine using Index Server. It mostly works, however there have been a few niggling problems and fixing it seems to be a case of patching errors as we find them so I'm thinking that it might be worth starting the logic from scratch and rebuilding this again. Basically we have a simple search, which is simply a...
8
9733
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my problem: my vb.net program has problems with UNC. If the UNC server is restarted or goes off-line, my VB.net program crashes. The code for UNC access to the file is included below and is put in the tick event of a form timer control running every...
0
4212
by: Chung Leong | last post by:
Here's a short tutorial on how to the OLE-DB extension to access Windows Indexing Service. Impress your office-mates with a powerful full-text search feature on your intranet. It's easier than you think. First, download and install the extension (http://sourceforge.net/project/showfiles.php?group_id=171247&package_id=198554). Simply unzip the file and copy the correct version of php_oledb.dll into the PHP extensions folder. Then add the...
8
2596
by: rempit | last post by:
Hye all..I'm Newbie.. I'm using asp.net..This code below I put in .aspx file..And become like that.. I want to make something like "WHEN USER PUT SOMETHING IN TEXTBOX AND CLICK THE BUTTON SEARCH..THE RESULT COMEOUT IN NEW ' div '.. I want to apply to my website..Using AJAX code.. I just copy the code from http://www.w3schools.com/ajax/ajax_database.asp. Help me please..
2
1676
by: princymg | last post by:
I want to search a file from server and want to copy it to the local disk. how it is done? This is working if the file is in my hard disk itself.But not when it comes to server. If i map the server i can search.like y:\\serverfolde\\folder am tring to make an exe. different people will map to different drive. so i cant give like that.should give like @\\server\\serverfolde\\folder\\ but it is not working. My code is...
9
15130
by: fniles | last post by:
I would like to copy a table(s) from SQL Server 2005 to a CVS file and vice versa. I was thinking to use the BCP command line utility, but I have a few questions: 1. The machine where I am going to run BCP utility does not have SQL Server installed, so BCP.exe and its underlying DLLs are not there. I copied BCP.EXE, then it tells me that it expects sqlncli.dll. After I copied that DLL, it now says "Unable to load BCP resource DLL. BCP...
1
1621
by: mravik | last post by:
Hi All, I have different subsystems in my application, if one is down it will through some error message in log file. I have a collection of error messages in another file and I want to check each message against a log file. my application is running on tomcat and log file will continuously appended by the server even there are no requests for server. My requirement is when I hit the server with a request, I want to capture the log of my...
0
7935
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7871
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
8236
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
8366
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
7995
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
6642
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...
1
5735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
1467
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1202
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.