简体   繁体   English

下载php文件tar

[英]downloading php files tar

I have a folder "a" with 10,000 php files in. FTP is taking like forever. 我有一个包含10,000个php文件的文件夹“ a”。FTP像永远一样。

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. 我有sudo的linux ubuntu。

Bundle/Compress: tar czf a.tar.gz a/ 捆绑/压缩: tar czf a.tar.gz a/

Decompress/Extract: tar xzf a.tar.gz 解压缩/提取: 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 tar man pages上阅读更多tar man pages

  • You could compile PHP with zip support? 您可以编译带有zip支持的PHP吗?
  • using zip command: 使用zip命令:

    zip -r archivefile1 . 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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