Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

ftp-ext

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

ftp-ext

bundlerRubygems
Version
0.1.4
Version published
Maintainers
1
Created
Source

FTPExt

A simple gem for copying, synching, and deleting entire folders over FTP. Adds two new public methods to Net::FTP — put_dir and rmrf_dir. put_dir takes a hash of arguments:

  • local - (string) The relative or absolute path to the local directory to be copied.
  • remote - (string) The relative or absolute remote path that the local directory will be copied to.
  • verbose - (bool: defaults to false) Will output progress if set to true.
  • erase - (bool: defaults to false) If set to true, put_dir will overwrite any existing directories (default behavior is to update changed files only).
  • exclude - (array) A list of any files in local directory to be excluded. All file paths in exclude should be relative to local

rmrf_dir takes two arguments: the path to the remote directory to be deleted, and a verbose boolean flag (defaulted to false).

Usage

To use FTPExt, require it and use Net::FTP as normal. Because FTPExt requires Net::FTP for you, you don't need to include it separately.

require 'rubygems'
require 'ftp-ext'

ftp = Net::FTP.new('ftp/server/address')
ftp.login('username', 'password')

ftp.put_dir(:local => 'path/to/local', :remote => 'path/to/remote')

For example, imagine I have a local directory, /Users/zpendleton/code, that I want to upload on my server to the /home/zpendleton directory. I'd run the following command:

ftp.put_dir('/Users/zpendleton/code', '/home/zpendleton/code')

If the code directory already exists in /home/zpendleton, it will be updated (the script checks the last modified timestamps of all files). If the code directory doesn't exist, it will be created. To overwrite the code directory on the server, set the :erase option in put_dir to true.

To later delete the /home/zpendleton/code directory (in verbose mode), you would use:

ftp.rmrf_dir('/home/zpendleton/code', true)

To leave verbose mode turned off, you would just omit the second parameter.

Contributing

  • Fork the project.
  • Create a branch (git checkout -b my_edit).
  • Commit your changes (git commit -am "Added feature").
  • Push to the branch (git push origin my_edit).
  • Create an issue with a link to your branch.
  • Kick it old school to this while you wait.

Copyright (c) 2010 Zach Pendleton. See LICENSE for details.

FAQs

Package last updated on 03 Jan 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts