glynn icon indicating copy to clipboard operation
glynn copied to clipboard

Feature Request: Upload changed files.

Open 128keaton opened this issue 9 years ago • 6 comments
trafficstars

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

128keaton avatar May 04 '16 18:05 128keaton

This is definitely the right way of doing this.

dmathieu avatar May 04 '16 18:05 dmathieu

@dmathieu wow! quick response! I'd love to try, but Ruby, as I said, is not something I have good understanding of.

128keaton avatar May 04 '16 18:05 128keaton

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 avatar May 04 '16 18:05 dmathieu

@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

128keaton avatar May 04 '16 19:05 128keaton

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..

128keaton avatar May 04 '16 21:05 128keaton

I was unable to make progress, any word from anyone else?

128keaton avatar May 31 '16 03:05 128keaton