David19801
David19801

Reputation: 11448

downloading php files tar

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

Answers (3)

Alfred
Alfred

Reputation: 61771

  • You could compile PHP with zip support?
  • using zip command:

    zip -r archivefile1 .

    This copies the current directory, including all subdirectories into the archive file.

Example:

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

Malachi
Malachi

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

Matt
Matt

Reputation: 44058

Bundle/Compress: tar czf a.tar.gz a/

Decompress/Extract: tar xzf a.tar.gz

Upvotes: 3

Related Questions