I just zip a file in my remote server using the command "unzip" in the SSH terminal. It works fine but leaves a new folder called "__MACOSX".
Is there any way to make that the command delete this file after the unzip?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityThis is an extra folder that OSX computers make, they are hidden on OSX.
To exclude the folder from the extraction do:
unzip ZipName.zip -x __MACOSX/*
Replace "ZipName" with the name of your zip. The important part is matching the folder which is made up of two underscores then MACOSX, /* so it doesn’t extract the hidden file in that folder as well as the folder.
unzip file.zip -d destination_folder
*Apple provides built-in capability to ZIP files in OS X 10.3 and higher, and these files are the result of Apple storing Resource Forks safe manner. You would never see these files running OS X 10.3 or higher, but since Windows and other operating systems do not understand this special form of Resource Forks they will appear as you see them.