curl-library
RE: libcurl FTP - directory listing by file mask
Date: Fri, 28 Mar 2008 12:02:01 -0400
Well, if you use single quotes... You are right.
All in all, wildcards is not the latest addition to UNIX shells and most
UNIX shell commands and ftp do recognize wild cards. Built-in ftp client
lists *.txt as one of files with 'txt' extension and leaves it up to the
user to sort out any issues arising from funky file naming.
Is there any way to receive a remote directory wildcard file listing
with libcurl?
-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Ralph Mitchell
Sent: Friday, March 28, 2008 11:38 AM
To: libcurl development
Subject: Re: libcurl FTP - directory listing by file mask
On Fri, Mar 28, 2008 at 10:11 AM, Alla Bogolubov <abogolub_at_opentext.com>
wrote:
> Dan, Built-in ftp clients on most platforms have mget functions
> implemented. You can issue a command 'mget *.txt' and you will
receive
> all files that meet the mask. I doubt that *.txt is legal as a file
name
> on UNIX. I was unable to create a file with this name on HP-UX or
> Solaris. Also, try 'ls *.txt' or 'vi *.txt' It will list all files
with
> *.txt extension and open *.txt files one after another.
Just FYI:
-bash-3.00$ touch '*.txt'
-bash-3.00$ touch star.txt
-bash-3.00$ ls -l
total 0
-rw-r--r-- 1 myuser other 0 Mar 28 10:31 *.txt
-rw-r--r-- 1 myuser other 0 Mar 28 10:31 star.txt
-bash-3.00$ rm '*.txt'
-bash-3.00$ ls -l
total 0
-rw-r--r-- 1 myuser other 0 Mar 28 10:31 star.txt
The same works on both Solaris 10 and Gentoo Linux. Actually, so does
this:
-bash-3.00$ touch '! @ # $ % ^ & * ( )'
-bash-3.00$ ls -l
total 0
-rw-r--r-- 1 myuser other 0 Mar 28 10:34 ! @ # $ % ^ &
* ( )
I'm not saying it's *useful*, but it's not difficult either.
Ralph Mitchell
Received on 2008-03-28