coolestavi007
New member
- Joined
- Aug 25, 2008
- Messages
- 3
- Programming Experience
- 1-3
i want to create subdirectory on the server.But unable to create there.
here is the logic of directory which i want to create on the server..
plz help me out..
VB.NET:
Shared Sub main2(ByVal zipdir, ByVal systemname)
'FTP creadentials'
Dim servertemp As String = "ftp://hydhtc25116"
Dim username As String = "hydhtc25116\root"
Dim password As String = "infy@123"
Dim host As String = servertemp
'Renaming the zip file as the current system date'
Dim filename As String
filename = zipdir
Dim New1 As String
Dim month1 As String
Dim year1 As String
Dim day1 As String
day1 = DatePart("d", DateTime.Now)
month1 = DatePart("m", DateTime.Now)
year1 = DatePart("yyyy", DateTime.Now)
New1 = systemname + "_" + day1 + "-" + month1 + "-" + year1
'Declaring the FTP zip filename as the current system Date'
Dim remoteFile As String = "/" & New1 & ".zip"
'1. Create a request: must be in [url]ftp://hostname[/url] format'
Dim URI As String = host & remoteFile
Dim ftp As Net.FtpWebRequest = CType(Net.FtpWebRequest.Create(URI), Net.FtpWebRequest)
'2. Set credentials
ftp.Credentials = New System.Net.NetworkCredential(username, password)
'3. Settings and action
ftp.KeepAlive = False
'4. we want a binary transfer, not textual data
ftp.UseBinary = True
'5. Define the action required (in this case, download a file)
ftp.Method = System.Net.WebRequestMethods.Ftp.UploadFile
'6. Reading the content of the zip file'
Dim bFile() As Byte = System.IO.File.ReadAllBytes(filename & "/" & New1 & ".zip")
Dim clsStream As System.IO.Stream = ftp.GetRequestStream()
'Writing the content of the file'
clsStream.Write(bFile, 0, bFile.Length)
clsStream.Close()
clsStream.Dispose()
clsStream.Flush()
End Sub
here is the logic of directory which i want to create on the server..
VB.NET:
Dim str As String = "C:\ProgramFiles\Ext\ABC\Stv\text.txt"
Dim newstr As String = str.Substring(0, 1)
Console.WriteLine(newstr)
Dim new1 As String = str.Substring(3, str.LastIndexOf("\") - 2)
Console.WriteLine(new1)
If Not Directory.Exists("C:\C\" & new1) Then
Directory.CreateDirectory("C:\C\" & new1)
End If
plz help me out..