472,378 Members | 1,685 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 software developers and data experts.

How can I get information of specific file in remote computer?

Hi,
How can I get information of specific file in remote computer?
I want to get file's status in other computer, this file belongs to shared
directory, I want to get the file size, existanse of the file ...,
When tring to acsess to file or get status it fails, Should I do login to
this computer? if so, how can I do it?

code examples are attached.

Thanks
Yaniv

// example:
if( (_access("\\191.26.58.21\SharedDir\myFile.txt", 0 )) != -1 )
{
printf("file exists");
}
else
{
printf("file not exists");
}

// output:
// file not exists
struct _stat l_StatusBuf;
if(_stat( "\\191.26.58.21\SharedDir\myFile.txt" , &l_StatusBuf ) != -1)
{
printf("got file status");
}
else
{
printf("fail getting file status");
}

// output:
// fail getting file status

Nov 15 '05 #1
1 3726
> How can I get information of specific file in remote computer?
I want to get file's status in other computer, this file belongs to shared
directory, I want to get the file size, existanse of the file ...,


System.IO.FileInfo gives you a lot of this information about the file. Use
UNC (Universal Naming Convetion) for the file name. If you need to specify
credentials to access the remote path, then I sugest you do a "net use ..."
before you run your program.

Hope that helps,
-JG

PS. Here's some sample code:

string fileName = "\\bpdportatil\pub\Bancasol.zip";
FileInfo fi = new FileInfo(fileName);
if (fi.Exists) {
Console.WriteLine("{0} has size: {1}.", fileName, fi.Length);
} else {
Console.WriteLine("{0} does not exist.", fileName);
}
Nov 15 '05 #2

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

Similar topics

5
by: DCK | last post by:
Hello I've path to file, which look like this: \\COMPUTER\D$\C++\FILE_TO_DELETE.JPG This path was generated by os.path.walk() function. When i try to delete this file, os.remove() can't find...
2
by: Rocket Hawk | last post by:
Hello All, I am using windows 2000 server IIS 5.0 i was trying to run bat file from asp page and getting: Access Denied but when i run the bat file from the command prompt on the local...
0
by: Daniel | last post by:
Is it possible to retain local file system read, write, delete access while impersonating for access to a remote drive in a different domain? I need to be able to move files from a local computer...
1
by: Bhavya Shah | last post by:
Hello All, I am facing a serious problem while copying a file to a remote computer programmatically. What I want to do: I want to connect to a remote computer and copy a file to the remote...
8
by: Lam | last post by:
HI anyone knows how can I open a mapped network file in C#? I try string file = @"T:\file.txt"; it shows me the error: "Could not find a part of the path" but if I copy the file to my C dirve,...
7
by: Kevin | last post by:
I'm using a File.OpenRead call within a custom httphandler to read a file from a remote computer using a unc path as the parameter to OpenRead. This is done within an impersonation call to ensure...
23
by: wylbur37 | last post by:
I'm running an Apache server on my own computer (Windows XP Pro). I wrote a simple PHP script (called test3.php) that I'm running by putting the following URL in the address bar of the browser...
2
by: schaf | last post by:
Hi Ng ! I'm a little confused because of my application. I need to access a file in the path C:\Temp\test.txt on a computer in the same network. Now I just know the IP address of this PC. Is it...
2
by: Martin | last post by:
From a PHP script, is there any way to retrieve data from an MS Access database that's located on another computer (on a LAN) other than by using ODBC? I posted a question here a couple of weeks...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

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.