Search code examples
linuxpowershell7zip

Not unzipping all files while using 7z in shell script


I am using below command

echo "A"|7z x -r -y /usr/sap/Silentinstall/commerce/commerce.7z.001

When I ran it from linux machine i.e. from cmd it works and it unzips all the files and folders.

But It it not extracting full files and folder when I am running it in shell script as below

#!/bin/sh
cd /usr/sap/Silentinstall/commerce
echo "A"|7z x -r -y /usr/sap/Silentinstall/commerce/commerce.7z.001
chmod -R 777 /usr/sap/Silentinstall/*

Solution

  • After lot of approaches i found below Solution,

    cd /usr/sap/Silentinstall/commercedownloads 7z x /usr/sap/Silentinstall/commercedownloads/testcomm.7z.001 -o/usr/sap/Silentinstall/commercedownloads -aoa -r >>/usr/sap/Silentinstall/commercedownloads/log.txt chmod -R 777 /usr/sap/*