Error Script mv: can not move new_name to new_name / original_name Directory not empty

0

Hello, I have the following function, the goal is to verify that the folder exists, and delete , 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}

But I'm getting the following error:

  

mv: can not move 'openssl-1.0.2g' to   'Openssl-1.0.2g-armv6 / openssl-1.0.2g': Directory not empty

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

When there are no folders to be deleted, everything works fine, I'm not sure if any code is wrong, how can I solve this?

    
asked by anonymous 05.05.2016 / 01:01

1 answer

0

There was no command to delete the folder openssl-1.0.2g-armv6 so it was giving error.

# 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}
    
05.05.2016 / 01:25