Try using FTPDir in place of FTPFileSize. If it fails then you deal with a file and continue from there, otherwise you deal with a directory and so you should skip it advance to the next name in the list For example : hey, : Using the FTPdir command how can I disseminate between files and directories : with the returned results? : I get a file list: file1,file2,file3,file4. : File1 = dir : File2 = dir : File3 = file : File4 = file : I am performing a ftpdir command that returns “file1,file2,file3,file4” : When I process file1 with FTPfileSize it is returning the a value even though : it is a directory. I expected zero bytes back : I want to process files meeting a file mask and discard the directories. Any : suggestions?? : CODE sample: Dim res_output_path_and_name, string, "" //the : returned file path and name of file Resolute will process. : dim res_filemask, string, "fi*.*", //file mask to retreive from : EPIC server. : dim res_directory, string, "/dir1/dir2/claim/" //Directory to look : in. : dim res_path_mask, string, "" : dim res_d_results, string, "" //Comma seperated list of files : returned from the FTPDir command. : //This is the list of files to be processed. : dim res_res_lngth, number, "" //the length of the results file. : dim m_lngth, number, "" // used to determin if a Claims files are : in the : dim m_var_name, string, "" // this is the variable returned from : res_d_results. : dim m_file_exists, boolean, "" //set to true if the name found is a : file and not a directory. : // /epic/resolute/claim directory : ftpdir res_ftpserver, res_ftpuser, res_ftppassword, res_directory, : res_d_results : messagebox res_d_results : length res_d_results, res_res_lngth : LoopWhile res_res_lngth, e_loop : top_of_Loop: length res_d_results, res_res_lngth : instr res_d_results, ",", 1, m_lngth : //this retreives the first file/directory : left res_d_results, m_lngth, m_var_name : subtract res_res_lngth, m_lngth, res_res_lngth : right res_d_results, res_res_lngth, res_d_results : instr m_var_name, ",", 1, m_lngth : ifthen (m_lngth, chomp) : goto check_file : chomp: subtract m_lngth, 1, m_lngth : left m_var_name, m_lngth, m_var_name : check_file: Concat res_directory, m_var_name, res_output_path_and_name : onerrorresumenext : ftpfilesize res_ftpserver, res_ftpuser, res_ftppassword, : res_output_path_and_name, m_file_size : IFthen (m_file_size, transfer_file) : //the file was a directory go to the top_of_loop to get the next file : goto top_of_loop : transfer_file: //ftpfileexists res_ftpserver, res_ftpuser, res_ftppassword, : res_output_path_and_name, m_file_exists : //test the list of files to see if they are files or directories : FTPgetFile res_ftpserver, res_ftpuser, res_ftppassword, : res_output_path_and_name, "F:\\claim"
|