Error while running bash script that moves files

Posted by K.K Patel on Ask Ubuntu See other posts from Ask Ubuntu or by K.K Patel
Published on 2012-12-20T10:52:50Z Indexed on 2012/12/20 11:13 UTC
Read the original article Hit count: 617

Filed under:
|

I am new to bash scripting and want to create bash script that moves some days old files between source and destination as per days defined in script.

When I run this script I get error line 16: syntax error near unexpected token `do'

#!/bin/bash

echo "Enter Your Source Directory"
read soure

echo "Enter Your Destination Directory"
read destination 

echo "Enter Days"
read days


do 

   find $soure -mtime +$days  mv $soure $destination {} \;

  echo "Files $days old moved from $soure to $destination"

done

please help me to create this script.

© Ask Ubuntu or respective owner

Related posts about bash

Related posts about scripts