How to get the creation date of a c#file

Asked

Viewed 1,034 times

1

I have a web system in c# and I am using framework 4.5 that accesses a database Firebird that is on a server, I am connecting to this database normally.

Now I need to have access to the creation date of this file, I’m using the following method:

    static public DateTime PegarDataCriacaoBD (string caminhoBD)
        {
            DateTime dataCriacao = new DateTime();

            FileInfo arquivo = new FileInfo(caminhoBD);
            dataCriacao = arquivo.CreationTime;

            return dataCriacao ;
}

This method works perfectly, the issue is that I need to access a file that is on a particular IP on a particular port for example 197.152.365.14 at the door 3050 and the path of the database is C:\Sistema\Sistema.FDB, I am unable to access the file that is on this IP.

  • 4

    I don’t know if I got it wrong, but I think there’s been a mix-up between accessing the file and accessing DB. This function described above is for files. IP and port used by Firebird do not give access to the file, but its data. I have the impression that, to use Fileinfo, you would have to share the file folder on said machine, and access by network name. \\197.152.365.14\compartilhada\Sistema.FDB

  • But the file is not on the network. Would have some way to get the date of creation of a file that is on another computer ?

  • 3

    If you are not on the network, where are you? Another computer disconnected from the network? There is no way. Without access to the other computer there is no way. If it’s on the net, it’s like Bacco said.

  • I play very little with Firebird, I don’t know, but maybe the FB itself has some resource to return this information. If not, you need to run something on the machine to give it back to you (or her own share, or some soft that gives you back what you want).

  • It will be on a server other than the application, the application is in Service1 and the database is in the server2, so I wanted to get the file creation date of the data group that is in the server2

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.