简体   繁体   中英

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.

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

Decompress/Extract: tar xzf a.tar.gz

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

  • 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM