It would be better to use
rmdir tmp
in that last line instead of rm -r tmp
-- that way, if previous command failed for any reason or was mistyped, you won't lose all your data.