how to transfer file without replacing old files using pscp by vb6

0

I have an app. when on click it will transfer all text files to server but it replaces the old files. I want to transfer the new files without replacing the old files.

here is my code that when you click the command key and will run the command shell:

pscp -pw password *.txt server@ipaddress:/path

for example. i have a file named "filename_0000.txt" and "filename_0001.txt" transfered on the server. then I will transfer a new file also named "filename_0000.txt". the result should be

filename_0000.txt
filename_0000(1).txt or filename_0000_1.txt
filename_0001.txt

here is the vb6 code

Private Sub Command1_Click()
    res = Shell("cmd /c " & Trim(Text1.Text) & " >> " & App.Path & "\dir.txt")
    Timer2.Enabled = True
End Sub

Private Sub Timer2_Timer()
Open App.Path & "\dir.txt" For Input As #1
Do While Not EOF(1)
    Input #1, c
    List1.AddItem c
Loop
Timer2.Enabled = False
Close #1
End Sub

Vincent

Posted 2013-12-16T05:39:35.640

Reputation: 103

1What logic do you want to implement to stop them over writing? Saving to a new directory, changing the new or existing file names? – Dave – 2013-12-16T08:44:10.343

@DaveRook I've updated my post. thanks for the response – Vincent – 2013-12-20T06:29:14.883

@DaveRook I've update again my post. – Vincent – 2013-12-20T09:49:49.603

No answers