Support syncing directory and add --dir option.