glynn
glynn copied to clipboard
Feature Request: Upload changed files.
I was thinking about this earlier, and I think I have a solution. Ruby isn't my language, but I could try (in a bit) to execute. Anyway, I was thinking, first upload with glynn, a file would be created containing a modified date (or an MD5) for each file. This file would also be on the server. When glynn would run, it would check if any MD5s changed, and upload those corresponding files. Just thinking logically, and programmatically, it would go something like this:
glynn upload command
-> check MD5 file (for loop through files I guess)
--> has file changed?
--->Yes? Upload file, exit for loop
---> No? Exit for loop.
--> end for loop
This is definitely the right way of doing this.
@dmathieu wow! quick response! I'd love to try, but Ruby, as I said, is not something I have good understanding of.
Unfortunately, I haven't used glynn in years, and don't have any FTP server available at hand to test this. I might be able to implement this in the coming days/weeks, but will need someone to make sure it does properly work.
@dmathieu I'd happily help. I started something (from some internet examples)
Dir.foreach(ftp_dir) do |item|
next if item == '.' or item == '..'
File.write('md5', Digest::MD5.hexdigest File.read item)
end
Ok, I've been messing around a bit, and I've got this far: https://github.com/128keaton/glynn/blob/master/lib/glynn/ftp.rb#L80
I am, however, having issues. I can read the digest of the MD5s of things inside of folders, but they don't want to write for some reason..
I was unable to make progress, any word from anyone else?