当我执行这个程序,它工作得很好,但验证返回false。 如果我重新执行,验证工作。
fullpath
是备份的目录, refpath
是路径到原始文件:
if (fullpath.include?(refpath) && refpath.empty? == false && fullpath.empty? == false)
diffpath= "#{fullpath} #{refpath}"
puts diffpath
sortie = IO.popen("diff -Bb #{diffpath}").readlines #(fullpath backup_dir)
#puts fullpath
if sortie.empty?
puts "Les fichiers -#{f} sont identiques."
else
puts "Modification : [#{refpath}] \n [#{fullpath}] "
end
end
主要项目是:
require "modif.rb"
require "testdate.rb"
require "restore_data.rb"
#Pour la sauvegarde des fichiers
puts "__________SAUVEGARDE__________"
#Pour la restauration des fichiers :
puts "__________RESTAURATION__________"
#Vérification de l'intégrité des fichiers restaurés.
puts "__________VERIFICATION__________"
sleep(5.0)
v = Verif.new
v.do_verif(outdir)
当我打开其中还原文件的目录,文件没有完全写入。
调用验证之前,我打电话保存,备份和验证。
该sleep
不工作。 这个过程是完全暂停,不会写丢失的文件。