# Re: FTP#mget, FTP#mput

**URL:** <https://www.ruby-forum.com/t/re-ftp-mget-ftp-mput/94668>\
**Category:** Ruby\
**Created:** [May 10, 2006, 6:08pm UTC](https://www.ruby-forum.com/t/re-ftp-mget-ftp-mput/94668 "2006-05-10T18:08:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [May 10, 2006, 6:08pm UTC](https://www.ruby-forum.com/t/re-ftp-mget-ftp-mput/94668/1 "2006-05-10T18:08:52Z")

</div>

> > 
> 
> this does something like mput

I guess I’m not sure how this is different that just doing something  
like this:

module Net  
class FTP  
def mput(pattern, &block)  
Dir[pattern].each{ |file| put(file, &block) }  
end

```
  def mget(pattern, &block)
     Dir[pattern].each{ |file| get(file, &block) }
  end

```

end  
end

I haven’t test that, but if it looks alright perhaps I’ll submit it as a  
patch to -core.

Regards,

Dan

This communication is the property of Qwest and may contain confidential  
or  
privileged information. Unauthorized use of this communication is  
strictly  
prohibited and may be unlawful. If you have received this communication  
in error, please immediately notify the sender by reply e-mail and  
destroy  
all copies of the communication and any attachments.

---

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [May 10, 2006, 6:18pm UTC](https://www.ruby-forum.com/t/re-ftp-mget-ftp-mput/94668/2 "2006-05-10T18:18:01Z")

</div>

On Thu, 11 May 2006, Berger, Daniel wrote:

> > > 
> > 
> > this does something like mput  
> > end
> 
> ```
> def mget(pattern, &block)
> Dir[pattern].each{ |file| get(file, &block) }
> end
> 
> ```

Dir[pattern] is on the **client**. globbing for mget most occur against  
a  
listing from the **server**.

eg.

```
 mget foo*

```

means get all files from the server that match foo\* - the only way to  
do  
this is to combine an ftp.list with fnmatch.

regards.

-a

---

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [May 10, 2006, 6:21pm UTC](https://www.ruby-forum.com/t/re-ftp-mget-ftp-mput/94668/3 "2006-05-10T18:21:08Z")

</div>

On May 10, 2006, at 12:06 PM, Berger, Daniel wrote:

> > > 
> > 
> > this does something like mput  
> > end
> 
> Regards,
> 
> Dan

I’m not sure but I think mget’s pattern is supposed to apply on the  
server, not the local system. I could be wrong though.
