Tranfere Files From Windows to Unix directories.

Hi,

I'm not sure what the best way of doing this is but I have access to Visual Studio.net, and throught of making a simple application (.exe) so that other people can select a file from a windows network and move it or copy it to a Unix root directory, I know there are programs that they can download for free, but I just want to make a simple application for them.

Just need some suggestions on where to go with this.

Thanks.
mmatharuAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

armoghanCommented:
Hi mmatharu,
few ways
1. Either use FTP to transfer . You have to use the FTP api
2. Make a Samba share. that will act as Network Share in NT systems. so the transfer will be no more difficult then copying it to a Share
3. install a webBrowser and Make an uploading mechanism via Web (Not a good way)

Cheers!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JohnnyGrCommented:
If you need it secure you can build a wrapper around the pscp.exe program wich is a SSH transfer program, requires SSH server on the unix box tho...

Code:

Imports System.IO
Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.TextBox1 = New System.Windows.Forms.TextBox
        Me.Button1 = New System.Windows.Forms.Button
        Me.Button2 = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(5, 5)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(224, 20)
        Me.TextBox1.TabIndex = 0
        Me.TextBox1.Text = ""
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(235, 5)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(64, 22)
        Me.Button1.TabIndex = 1
        Me.Button1.Text = "Browse"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(5, 35)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(295, 20)
        Me.Button2.TabIndex = 2
        Me.Button2.Text = "Send file to server"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(302, 61)
        Me.Controls.Add(Me.Button2)
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.TextBox1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        'Select file
        Dim fileBrowser As New OpenFileDialog
        With fileBrowser
            .ShowDialog(Me)
            If DialogResult.OK Then
                TextBox1.Text = .FileName
            End If
        End With
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        If File.Exists(TextBox1.Text) Then
            'Wrap the plink binary

            Dim strPscpPath As String = Application.StartupPath & "\pscp.exe"
            Dim strUsername As String = "unix_username"
            Dim strPassword As String = "unix_password"
            Dim strSourceFilename As String = TextBox1.Text
            Dim strDestinationHost As String = "unix_host"
            Dim strDestinationPath As String = "/target/dir/"

            Dim pscp As New System.Diagnostics.ProcessStartInfo
            pscp.FileName = strPscpPath
            pscp.Arguments = "-pw " & strPassword & " " & Chr(34) & strSourceFilename & Chr(34) & " " & strUsername & "@" & strDestinationHost & ":" & strDestinationPath

             Dim pscpProcess As Process = System.Diagnostics.Process.Start(pscp)

        End If
    End Sub
End Class



This requeres the pscp.exe file in the same dir as your application... pscp also takes multiple input files and so on...

just an idea...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.