Reputation: 11448
I have a folder "a" with 10,000 php files in. FTP is taking like forever.
I was thinking about zipping the folder somehow, then downloading that..
Do you know what command line I can use to zip it and unzip it? I have linux ubuntu with sudo.
Upvotes: 0
Views: 215
Reputation: 61771
zip -r archivefile1 .
This copies the current directory, including all subdirectories into the archive file.
alfred@alfred-laptop:~$ mkdir -p a
alfred@alfred-laptop:~$ cd a
alfred@alfred-laptop:~/a$ echo "1" > 1
alfred@alfred-laptop:~/a$ echo "2" > 2
alfred@alfred-laptop:~/a$ mkdir -p b
alfred@alfred-laptop:~/a$ cd b
alfred@alfred-laptop:~/a/b$ echo "3" > 3
alfred@alfred-laptop:~/a/b$ cd ..
alfred@alfred-laptop:~/a$ zip -r a.zip .
adding: 1 (stored 0%)
adding: 2 (stored 0%)
adding: b/ (stored 0%)
adding: b/3 (stored 0%)
alfred@alfred-laptop:~/a$ unzip a.zip -d unzipped
Archive: a.zip
extracting: unzipped/1
extracting: unzipped/2
creating: unzipped/b/
extracting: unzipped/b/3
alfred@alfred-laptop:~/a$ cd unzipped/
alfred@alfred-laptop:~/a/unzipped$ ls -al
total 20
drwxr-xr-x 3 alfred alfred 4096 2011-02-02 13:14 .
drwxr-xr-x 4 alfred alfred 4096 2011-02-02 13:14 ..
-rw-r--r-- 1 alfred alfred 2 2011-02-02 13:12 1
-rw-r--r-- 1 alfred alfred 2 2011-02-02 13:12 2
drwxr-xr-x 2 alfred alfred 4096 2011-02-02 13:13 b
Upvotes: 1
Reputation: 33690
The following command can be used to compress the folder:
tar czf /path/to/output/folder/filename.tar.gz /path/to/folder
And you can uncompress with:
tar xvzf target.tar.gz
Read up more on the tar man pages
Upvotes: 3
Reputation: 44058
Bundle/Compress: tar czf a.tar.gz a/
Decompress/Extract: tar xzf a.tar.gz
Upvotes: 3