Scanning a directory on ftp

This is a discussion on Scanning a directory on ftp within the Windows Programming forums, part of the Platform Specific Boards category; Can someone tell me some functions that search a directory on ftp or a website that explains how to do ...

  1. #1
    Registered User
    Join Date
    Mar 2002
    Posts
    112

    Question Scanning a directory on ftp

    Can someone tell me some functions that search a directory on ftp or a website that explains how to do this. I can scan the harddrive with FindFirstFile, FindNextFile, but I need to know how to do it on ftp.

    Thanks

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    The API has functions prefixed with 'ftp' that may be of some interest to you, eg. FtpFindFirstFile.

  3. #3
    Registered User
    Join Date
    Mar 2002
    Posts
    112
    thanks Ken Fitlike,

    I tried to write a program to scan a ftp and it works, but it only displays the first file. Could you help me figure out whats wrong with this code?

    Code:
    #include <windows.h>
    #include <Wininet.h>
    #include <iostream.h>
    
    int main()
    {
        WIN32_FIND_DATA pDirInfo;
        HINTERNET hDir;
    	HINTERNET intOpen;
    	HINTERNET hConnect;
    	char userName[100]="";
    	char password[100]="";
    	char server[100]="";
    
    	cout << "Enter the server: ";
    	cin  >> server;
    	cout << "Enter your user name: ";
    	cin  >> userName;
    	cout << "Enter your password: ";
    	cin  >> password;
    
    	intOpen = InternetOpen("Microsoft Internet Explorer", INTERNET_OPEN_TYPE_DIRECT,
    		NULL, NULL,INTERNET_FLAG_ASYNC);
    	hConnect = InternetConnect(intOpen, server, INTERNET_DEFAULT_FTP_PORT,
    		userName, password, INTERNET_SERVICE_FTP, INTERNET_SERVICE_FTP, 0);
    
    	hDir = FtpFindFirstFile(hConnect, "*.*", &pDirInfo,
    			INTERNET_FLAG_DONT_CACHE, 0);
    	cout << "\nRoot Dir Contains:\n" << pDirInfo.cFileName << "\n";
    
    	while(InternetFindNextFile (hDir, &pDirInfo))
    		cout << pDirInfo.cFileName << "\n";
    
       	return 0;
    }

  4. #4
    Registered User
    Join Date
    Mar 2002
    Posts
    112
    HEEEEEEEEEEEEEELLLPPPPPPPPPPPPP MEEEEEEEEEEEEEEEEEEEEE!



    ... please.

  5. #5
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Originally posted by pinkcheese
    HEEEEEEEEEEEEEELLLPPPPPPPPPPPPP MEEEEEEEEEEEEEEEEEEEEE!



    ... please.
    You're definitely gonna get told by the mods for that one!

  6. #6
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Exactly..... no bumping threads.... (and no grovelling, either )
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  7. #7
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    FtpFindFirstFile/FtpFindNextFile

    Makes sense, huh? Look them both up on MSDN. (msdn.microsoft.com)

  8. #8
    Registered User
    Join Date
    Mar 2002
    Posts
    112
    There is no FtpFindNextFile, its InternetFindNextFile.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 10:38 AM
  2. Couple errors please help :-D
    By JJJIrish05 in forum C Programming
    Replies: 9
    Last Post: 03-06-2008, 02:54 AM
  3. How to program in unix
    By Cpro in forum Linux Programming
    Replies: 21
    Last Post: 02-12-2008, 10:54 AM
  4. Scanning a directory
    By ColdFire in forum Windows Programming
    Replies: 1
    Last Post: 06-16-2003, 05:39 AM
  5. Directory reading trouble
    By samGwilliam in forum Linux Programming
    Replies: 0
    Last Post: 03-10-2002, 09:43 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21