Method: Ftpd::DiskFileSystem::List#dir

Defined in:
lib/ftpd/disk_file_system.rb

#dir(ftp_path) ⇒ Array<String>

Expand a path that may contain globs into a list of paths of matching files and directories. The paths returned are fully qualified, relative to the root of the virtual file system.

For example, suppose these files exist on the physical file system:

/var/lib/ftp/foo/foo
/var/lib/ftp/foo/subdir/bar
/var/lib/ftp/foo/subdir/baz

and that the directory /var/lib/ftp is the root of the virtual file system. Then:

dir('foo')         # => ['/foo']
dir('subdir')      # => ['/subdir']
dir('subdir/*')    # => ['/subdir/bar', '/subdir/baz']
dir('*')           # => ['/foo', '/subdir']

Called for:

  • LIST

  • NLST

If missing, then these commands are not supported.

Parameters:

  • ftp_path (String)

    The virtual path

Returns:

  • (Array<String>)


313
314
315
316
317
# File 'lib/ftpd/disk_file_system.rb', line 313

def dir(ftp_path)
  Dir[expand_ftp_path(ftp_path)].map do |path|
    path.sub(/^#{@data_dir}/, '')
  end
end