When I execute this program, it works well but the verification returns false. If I re-execute it, the verification works.
fullpath
is the directory of the backup, and refpath
is the path to the original files:
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
The main program is:
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)
When I open the directory where the files are restored, the files are not completely written.
Before calling the verification, I call save, backup and verification.
The sleep
doesn't work. The process is completely paused and won't write the missing files.