FTP - Rename and Transfer to Folder

ketax

New member
Joined
Sep 17, 2007
Messages
2
Programming Experience
Beginner
Hi,

I'm a newbie of VB.net. I want to rename my file and move the renamed file to another folder. But I cant do that by using this code:

If (ff.RenameFile(strTemp1, Now().ToString("/oeprocessed/" & ("MMddHHmm") & "_" & strTemp1))) Then
'Successful renaming the file on the FTP site
Console.WriteLine(strTemp1 & " Rename Successfully")
objOutputLogFile.WriteLine(strTemp1 & " Rename Successfully")
Else
'Unsuccessful renaming the file on the FTP site
Console.WriteLine(strTemp1 & " Rename Failed")
objOutputLogFile.WriteLine(strTemp1 & " Rename Failed")
End If


The only problem is after renaming the existing file, my program cannot transfer the renamed file to the specific folder, in this case "oeprocessed/" folder. Please advise.
 
I found the solution. I have to put like this... :D

If (ff.RenameFile(strTemp1, ("oeprocessed/") & Now().ToString("MMddHHmm") & "_" & strTemp1)) Then

'Successful renaming the file on the FTP site
Console.WriteLine(strTemp1 & " Rename Successfully")
objOutputLogFile.WriteLine(strTemp1 & " Rename Successfully")
Else
'Unsuccessful renaming the file on the FTP site
Console.WriteLine(strTemp1 & " Rename Failed")
objOutputLogFile.WriteLine(strTemp1 & " Rename Failed")
End If
 
Back
Top