L
Lincoln Anderson
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello...
I am attempting to write a client side script that mirrors a user's
/home/* on a remote server. Granted, I *could* use ftpmirror in my
Ubuntu distribution, but I'd like to get more familiar with network
and filesystem operations in Ruby.
The basic algorithm as I see it would be to logon, get a list of all
files and folders via the Net::FTP.list(*args) command, run it through
a block or a for loop or some other iterator, ducking into
subdirectories as needed (and mkdir-ing them on the client side), and
doing a get() of all the files in each subdirectory.
Here's where my problem comes in. How can I tell from the list array
whether an item is a directory or a file to be copied? Is there
something I can use (such as an FTP command) to catch a clue on how to
implement this? I know this is possible, as ftpmirror is done with
PERL and Ruby can do anything PERL can do - better
Google is no help, and neither is running searches on ruby-talk
itself... Anyone done anything similar and have any tips? Any advice
whatsoever is appreciated.
Lincoln Anderson
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFBeV4Kte2c0P8BH0RAo4TAJ9sdFbwO/W6JdMpIxNULjC0ivjGdACbBSr5
Qqg1SW+aKBPyWB4rURKu5Lk=
=2OL8
-----END PGP SIGNATURE-----
Hash: SHA1
Hello...
I am attempting to write a client side script that mirrors a user's
/home/* on a remote server. Granted, I *could* use ftpmirror in my
Ubuntu distribution, but I'd like to get more familiar with network
and filesystem operations in Ruby.
The basic algorithm as I see it would be to logon, get a list of all
files and folders via the Net::FTP.list(*args) command, run it through
a block or a for loop or some other iterator, ducking into
subdirectories as needed (and mkdir-ing them on the client side), and
doing a get() of all the files in each subdirectory.
Here's where my problem comes in. How can I tell from the list array
whether an item is a directory or a file to be copied? Is there
something I can use (such as an FTP command) to catch a clue on how to
implement this? I know this is possible, as ftpmirror is done with
PERL and Ruby can do anything PERL can do - better
Google is no help, and neither is running searches on ruby-talk
itself... Anyone done anything similar and have any tips? Any advice
whatsoever is appreciated.
Lincoln Anderson
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFBeV4Kte2c0P8BH0RAo4TAJ9sdFbwO/W6JdMpIxNULjC0ivjGdACbBSr5
Qqg1SW+aKBPyWB4rURKu5Lk=
=2OL8
-----END PGP SIGNATURE-----