locked
Remove files from remote computer? RRS feed

  • Question

  •  

    I am trying to figure out a way to delete files on a remote machine from a windows application. We know the remote machine IP address and directory path to of the files. Do we have to create a new user account on remote machine..if yes, what permissions this user should have? What should be the permission of the folder where the files reside.

     

    Any help on this would be highly appreciable.

     

    thanks

    pintoo

     

    Friday, January 25, 2008 8:36 PM

Answers

  • Hello,

     

    1. Instead of using shared folders, we may also consider absolute paths. Suppose that we want to visit the path d:\test\file\ on the server "myserver", we can write the whole path as:

     \\myserver\D$\test\file\

     

    2. As for the permission, it depends on who runs that application. If user A starts the application, the system will check if the user A has proper permission for the remote folder when it runs File.Delete(@\\myserver\Filepath);. You may also consider this RunAs class

    http://www.codeproject.com/KB/cs/runas.aspx

    so that you can decide the runas user.

     

    Hope it helps.

    Regards,

    Jialiang Ge

    Monday, January 28, 2008 8:45 AM

All replies