Script with mv Error: cannot move new_name to new_name/original Directory not Empty

Asked

Viewed 65 times

0

Hello, I have the following function below, her goal is to check if the folder exists, and rule out, extract the file .tar.gz and rename.

ssl_v="1.0.2g"
ABI="armv6"
# Clean then Unzip
[ -d openssl-${ssl_v} ] && rm -fr openssl-${ssl_v}
tar xf openssl-${ssl_v}.tar.gz
[ -d openssl-${ssl_v} ] && mv openssl-${ssl_v} openssl-${ssl_v}-${ABI}

However I am getting the following error:

mv: cannot move ːopenssl-1.0.2g' to heg openssl-1.0.2g-armv6/openssl-1.0.2g': Directory not Empty

That is, he is creating a new folder(openssl-1.0.2g) within what should be deleted(openssl-1.0.2g-armv6).

When there are no folders to be deleted, everything works perfectly, not sure if some code is wrong, how can I fix this?

  • I also tried with mv openssl-${ssl_v} openssl-${ssl_v}-${ABI}

1 answer

0


There was no command to delete the folder openssl-1.0.2g-armv6 so I was making a mistake.

# Clean then Unzip
[ -d openssl-${ssl_v} ] && rm -fr openssl-${ssl_v}
[ -d openssl-${ssl_v}-${ABI} ] && rm -fr openssl-${ssl_v}-${ABI}
tar xf openssl-${ssl_v}.tar.gz
[ -d openssl-${ssl_v} ] && mv openssl-${ssl_v} openssl-${ssl_v}-${ABI}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.