Problem in FTP a file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coolestavi007
    New Member
    • Aug 2008
    • 10

    Problem in FTP a file

    Hi,
    Thing is that i have to create the directory as the path of the file of local server to the FTP server.
    Eg.
    Lets assume file is placed in "C:\program files\MS\Avi\Te xt.txt"
    when we will FTP this file to the server then it should place like this by creating the folder as : <c>\<program files>\<MS>\<Av i> and in the last folder ie "Avi", there we have to store the file called Text.txt.
    plz help me out regarding this.

    I am able to ftp the file Text.txt to the server but not able to create the folders on the server as the path of the file.
  • Curtis Rutland
    Recognized Expert Specialist
    • Apr 2008
    • 3264

    #2
    Have you tried using DirectoryInfo objects? They have a .Exists and .Create() members. You will need to have appropriate permissions.

    Comment

    • coolestavi007
      New Member
      • Aug 2008
      • 10

      #3
      Thanks for the reply. But I dont know the logic how to extract the path name and create sub directory on the server.
      let us assume the path of the file is:
      C;\Pm\Avi\kavi\ text.txt

      Then the text file should store like this:
      C(Directory)-->Pm(SubDirector y)--->kavi(SubDirect ory)----->text.txt

      means the text file will store at the last sub directory.

      plz help me out regarding this.

      Comment

      • cloud255
        Recognized Expert Contributor
        • Jun 2008
        • 427

        #4
        This is string manipulation. You should use the String class i believe there is a string.LastInde xOf() method which will return the last index of a character within a string, use this on your "/" then everything before that index is the directory path.

        Comment

        • coolestavi007
          New Member
          • Aug 2008
          • 10

          #5
          Very Very thanks for your reply...
          Can you plz give me an example to show a piece if code how it look like using lastindex operation.

          Comment

          • cloud255
            Recognized Expert Contributor
            • Jun 2008
            • 427

            #6
            Originally posted by coolestavi007
            Very Very thanks for your reply...
            Can you plz give me an example to show a piece if code how it look like using lastindex operation.
            Your welcome, i could give you the code, but the rules at bytes.com state that i cannot do someone else's work, so if you try it and experience issues, you can post your code and i could help you with it.

            Intillesense gives a pretty good explanation on the method.

            Comment

            • coolestavi007
              New Member
              • Aug 2008
              • 10

              #7
              okk....i will try first then get back to u if i will face any problem..

              Comment

              Working...