Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

create zip file command line

for ubuntu : zip -r example.zip original_folder
Comment

make zip file command

zip -r example.zip original_folder   // For Mobaxterm || Ubuntu etc
Comment

create zip file

// Get real path for our folder
$rootPath = realpath('folder-to-zip');

// Initialize archive object
$zip = new ZipArchive();
$zip->open('file.zip', ZipArchive::CREATE | ZipArchive::OVERWRITE);

// Create recursive directory iterator
/** @var SplFileInfo[] $files */
$files = new RecursiveIteratorIterator(
    new RecursiveDirectoryIterator($rootPath),
    RecursiveIteratorIterator::LEAVES_ONLY
);

foreach ($files as $name => $file)
{
    // Skip directories (they would be added automatically)
    if (!$file->isDir())
    {
        // Get real and relative path for current file
        $filePath = $file->getRealPath();
        $relativePath = substr($filePath, strlen($rootPath) + 1);

        // Add current file to archive
        $zip->addFile($filePath, $relativePath);
    }
}

// Zip archive will be created only after closing object
$zip->close();
Comment

PREVIOUS NEXT
Code Example
Shell :: what is my ip address ? 
Shell :: if file not exists 
Shell :: kali linux ping ip 
Shell :: add folders to gitignore 
Shell :: anaconda install for kali linus 
Shell :: wsl 2 installation 
Shell :: ubuntu 
Shell :: how to delete all ufw rules 
Shell :: rename file linux 
Shell :: delete a folder from git 
Shell :: store environment variables firebase 
Shell :: kubectl restart recreate pod 
Shell :: debian restart service 
Shell :: install kubernetes linux 
Shell :: cat first line 
Shell :: merge pdf in linux 
Shell :: how to make a file executable in linux 
Shell :: wsl distro 
Shell :: crear una aplicacion con angular cli 
Shell :: install mongodb ubuntu 
Shell :: creating new repository 
Shell :: install docker on linux 
Shell :: eliminare spooler di stampa 
Shell :: transfer git repo from gitlab to github 
Shell :: deno bundler 
Shell :: unable to start test validator. check .anchor/test-ledger/test-ledger-log.txt for errors. 
Shell :: ufw enable no disrupt 
Shell :: commands for ssh 
Shell :: git checkout specific file types only 
Shell :: how to provide 777 access recurssively unix 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =