Thread: Getting Error

  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2011
    Rep Power

    Unhappy Getting Error


    I have a configuration file name ( has the following enteries ....

    10 /home/admin/files /home/admin/output
    10 represents days(mofification time),
    /home/admin/files represents source folder from where the files will be picked up
    /home/admin/output represents whwre the files will be kept so it is a sort of destination

    I was planning to move files as per the modification time (10 days) from the source folder(files) location to the destination (output),I want my main script file should read my this configuration file( and take parameters from thaT

    I have written main script file name which will read this configuration file ...

    while read DAYS INDIR OUTDIR
    find $INDIR -type f "!" -mtime $DAYS -exec mv {} $OUTDIR \;
    done </home/Administrator/scripts/
    Now upon executing, I get the error that syntax error near unexpected token 'done'.please guide me how to corret this problem
  2. #2
  3. Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2006
    Rep Power
    Don't have a loop - you really don't need it here, try:

    cat /home/Administrator/scripts/ | read DAYS INDIR OUTDIR
    find $INDIR -type f "!" -mtime $DAYS -exec mv {} $OUTDIR \;
    Out of curiosity - what is the "!" supposed to be doing?
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo