Forums Register Login

wildcarding a URL

+Pie Number of slices to send: Send
I want my Java client to download for e.g. all XML files from a remote server through FTP. In other words, I want the URL to look something like this:
URL url = new URL("ftp://userName swd@ftp.site.com/*.xml")

How can I achieve this? In other words, is there some way I can retrieve all the file names that meet that wildcard criteria and then subsequently download those files one at a time.

Can a URL contain wildcard chars? If I have my information correct, the concerned RFC says it cannot contain wildcards.

Thnx
+Pie Number of slices to send: Send
Hi,

Welcome to JavaRanch!

First, a bit of business: you may not have read our naming policy on the way in. It reqiures that you use a full, real (sounding) first and last name for your display name. Initials aren't enough. You can change your display name here. Thanks, pardner!

Now, as to your question: no, URLs can't have wildcards, but the FTP protocol includes the LIST command and other commands to let you navigate through the file system and list the available files. You could use a client library like Jakarta Commons Net to get easy access to this functionality.
Live ordinary life in an extraordinary way. Details embedded in this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 612 times.
Similar Threads
Adding spring-security-core-3.0.5 to org.springframework.core-3.0.0.M3
FTP v/s HTTP, which one is better?
display FTP content
uploading files in JSP
downloading all the files in a folder through ftp
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 00:02:46.