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?

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.


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

// output:
// file not exists
struct _stat l_StatusBuf;
if(_stat( "\\\SharedDir\myFile.txt" , &l_StatusBuf ) != -1)
printf("got file status");
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,

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

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...
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...
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...
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...
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,...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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.
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.