How to move a file on remote FTP server to an directory on same FTP server using Net::FTP in ruby script -
how move file on remote ftp server directory on same ftp server using net::ftp in ruby script. know file name , have created directory using ftp.mkdir apparently there no method move file created folder.
files (& directories) can moved using rename()
method of net::ftp
class. example:
ftp = net::ftp.new("ftp.myserver.com","myusername","mypassword") ftp.binary = true ftp.passive = true path1 = "/original/dir/path/" # dir move path2 = "/new/path/" # new path of dir ftp.rename(path1, path2)
and that's it! causes files move 1 path on same ftp server.
Comments
Post a Comment