Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
trick to differentiate FTP files and Folders?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
evstevemd  
View profile  
 More options Jun 15 2012, 8:28 am
From: evstevemd <mwinjili...@gmail.com>
Date: Fri, 15 Jun 2012 05:28:59 -0700 (PDT)
Local: Fri, Jun 15 2012 8:28 am
Subject: trick to differentiate FTP files and Folders?
I'm using wxFTP and it works wonderfully. However I need to know how
to retrieve files only or folders only.
Checking with FTP have got not way and I'm not sure if there are
similar functionality to file system checks (wxDirExists and the
like).

I have no idea how to do that and I'm new to world of FTP (being using
FileZilla for FTP works)

TIA,
Stefano


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gadget/Steve  
View profile  
 More options Jun 15 2012, 2:03 pm
From: Gadget/Steve <GadgetSt...@live.co.uk>
Date: Fri, 15 Jun 2012 19:03:55 +0100
Local: Fri, Jun 15 2012 2:03 pm
Subject: Re: trick to differentiate FTP files and Folders?
On 15/06/2012 1:28 PM, evstevemd wrote:
> I'm using wxFTP and it works wonderfully. However I need to know how
> to retrieve files only or folders only.
> Checking with FTP have got not way and I'm not sure if there are
> similar functionality to file system checks (wxDirExists and the
> like).

> I have no idea how to do that and I'm new to world of FTP (being using
> FileZilla for FTP works)

> TIA,
> Stefano

Try looking at wxFTP::GetDirList and GetFileList there is also FileExists.

Gadget/Steve


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
evstevemd  
View profile  
 More options Jun 15 2012, 4:32 pm
From: evstevemd <mwinjili...@gmail.com>
Date: Fri, 15 Jun 2012 13:32:38 -0700 (PDT)
Local: Fri, Jun 15 2012 4:32 pm
Subject: Re: trick to differentiate FTP files and Folders?

On Jun 15, 9:03 pm, Gadget/Steve <GadgetSt...@live.co.uk> wrote:

> On 15/06/2012 1:28 PM, evstevemd wrote:> I'm using wxFTP and it works wonderfully. However I need to know how
> > to retrieve files only or folders only.
> > Checking with FTP have got not way and I'm not sure if there are
> > similar functionality to file system checks (wxDirExists and the
> > like).

> > I have no idea how to do that and I'm new to world of FTP (being using
> > FileZilla for FTP works)

> > TIA,
> > Stefano

> Try looking at wxFTP::GetDirList and GetFileList there is also FileExists.

Thanks Mr. Steve, I guess I have to go with
if(!filename.IsEmpty()){

if(ftp.FileExists(filename)){
    //it is a file

}
}else{
//it is a folder
}
}

If there is better way, I would appreciate to a comment.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
evstevemd  
View profile  
 More options Jun 15 2012, 4:47 pm
From: evstevemd <mwinjili...@gmail.com>
Date: Fri, 15 Jun 2012 13:47:48 -0700 (PDT)
Local: Fri, Jun 15 2012 4:47 pm
Subject: Re: trick to differentiate FTP files and Folders?
Tried to list folders only using function below unsucessfully. It
seems that FileExists check for existing file or folder

On FTP commandline I get:
ftp> ls -l
200 PORT command successful
150 Opening ASCII mode data connection for file list
drwxr-xr-x   2 root     root         4096 Mar  6  2009 ftp
drwx------   2 root     root        16384 Mar  5  2009 lost+found
drwxrwxr-x 118 bake     102          4096 Dec 14  2011 pub
226 Transfer complete

Here is part of the function
wxArrayString folders;
        unsigned int i;
        for(i=0; i<folders.GetCount(); i++) {
                if(!folders[i].IsEmpty() && !m_ftp.FileExists(folders[i])) {
                        //it is folder
                        m_ftp.GetDirList(folders);
                        m_folders->Set(folders);
                }
        }


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
evstevemd  
View profile  
 More options Jun 16 2012, 3:02 am
From: evstevemd <mwinjili...@gmail.com>
Date: Sat, 16 Jun 2012 00:02:32 -0700 (PDT)
Local: Sat, Jun 16 2012 3:02 am
Subject: Re: trick to differentiate FTP files and Folders?
Please ignore this code. I was overpowered by sleepness that I posted
something as useless as this one!

On Jun 15, 11:47 pm, evstevemd <mwinjili...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gadget/Steve  
View profile  
 More options Jun 16 2012, 3:22 am
From: Gadget/Steve <GadgetSt...@live.co.uk>
Date: Sat, 16 Jun 2012 08:22:25 +0100
Local: Sat, Jun 16 2012 3:22 am
Subject: Re: trick to differentiate FTP files and Folders?
On 15/06/2012 9:47 PM, evstevemd wrote:

The problem with the above fragment is that folders.GetCount() is that
it will always return zero as there is no GetDirList outside of it -
also I have found that FTP commands generally only work on the current
remote directory i.e. you need to chdir first so for example to get a
count of all the files, (not directories), on the remote system you
could use something like:

int GetFileCount(wxString SubDir="/", wxString WCard="")
{
   /* WARNING UNTESTED CODE Not sure it will even compile */
    wxArrayString FileList;
    wxArrayString DirList;
    int FileCount = 0;
    int n;

    m_ftp.ChDir(SubDir);  // Change the remote directory to the
sub-directory
    m_ftp.GetFileList(&FileList, WCard); // Get the file list
    FileCount = FileList.GetCount();  // Get the File count in the directory
    for (n = 0; n < DirList.GetCount(); n++) // Handle the sub-directories
    {
        FileCount += GetFileCount(DirList[n], WCard); // Recursive call
    }
    m_ftp.ChDir("..") // Back to where we were IMPORTANT
    return (FileCount) // Return the file count for the specified sub
directory

}

Hope that is some help.  If it works ok you could use it as a template
for a function that would get all the files that match a given wildcard,
etc.

Gadget/Steve


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
evstevemd  
View profile  
 More options Jun 16 2012, 3:37 am
From: evstevemd <mwinjili...@gmail.com>
Date: Sat, 16 Jun 2012 00:37:30 -0700 (PDT)
Local: Sat, Jun 16 2012 3:37 am
Subject: Re: trick to differentiate FTP files and Folders?

On Jun 16, 10:22 am, Gadget/Steve <GadgetSt...@live.co.uk> wrote:

Thanks a lot!

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
evstevemd  
View profile  
 More options Jun 21 2012, 5:53 am
From: evstevemd <mwinjili...@gmail.com>
Date: Thu, 21 Jun 2012 02:53:38 -0700 (PDT)
Local: Thurs, Jun 21 2012 5:53 am
Subject: Re: trick to differentiate FTP files and Folders?
It seems there is no way of distinguishing folder from file in FTP
(and so in wxFTP) but what suprises me is that filezilla handles it
well.
Filezilla have good chunk of code and so it will take time to get the
trick but if any have a way of doing it and is willing to share, I
will appreciate it!
TIA,
Stefano

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »