Linux Question: compare files AKA Backup FTP Script

update .. my newbie geek linux backup script is here what is wrong? Anyone like to help further? Maybe I can learn from it


6 thoughts on “Linux Question: compare files AKA Backup FTP Script

  1. You can for example check only sizes and time of the last modification for each file, this would be much quicker and probably fit your needs:

    du -a –time $FOLDER1 > /tmp/folder1
    du -a –time $FOLDER2 > /tmp/folder2
    diff /tmp/folder1 /tmp/folder2

  2. Maybe you can use rsync?

    You can use rsynch to make the 2 directories the same if that is your goal..

    rsync -av –delete /home/backup/ch3snas/ /home/backup/server/data

    the –delete make sure the files that are deleted in the source are also deleted in the target so the target will not grow out of diskspace.

    rsync has a lot more options ofcourse..

  3. rsync itself for the purpose is too slow
    my ‘script’ already works, but need to compare the target folder with the source if they are equal, if they are equal than the source files can be removed if not (due to failure in ftp) than the script must stop

  4. FOLDER1=$’/home/backup/server/data’
    FOLDER2=$’/home/backup/ch3snas/`date “+%d-%m-%y”`’
    du -a .time $FOLDER1 > /tmp/folder1
    du -a .time $FOLDER2 > /tmp/folder2
    Compare=$(diff /tmp/folder1 /tmp/folder2)

    FOLDER2 does not work as I want it. Folder2 has the date of today, and this folder must be compared, but the date command seems not to work as environment

  5. Robbie72 says:


    Kan het mis hebben, maar mis je niet 1x else ????

    In het begin 2x if then, naar na wat commando’s maar 1x else….

    Je mist de else van if [ ! -n “$Compare” ]; then
    of van if [ -e data ] then

    volgens mij…

  6. Hi Robbie, thanks for your answer

    I have solved my issue by buying a script for bluequartz..
    that was more easy than all the hassle I had to do myself programming

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.