Work log-w1444

Source: Internet
Author: User
Tags perl script

1. robocopy: an advanced application for copying files and directory trees (in Windows)

2. [Perl] File: path mkpath and rmtree are the directory for creating and deleting directories respectively. Perl comes with mkdir and rmdir, but mkdir can only create multiple levels at a time using the mkpath directory; rmdir requires that the directory be empty, while rmtre is arbitrary.

3. [Perl] unlink: delete files. In PHP, unlink has the same function.

4. [Perl] quotemeta ("expr") escape all metacharacters in expr.


print quotement("AB*\n[.]*");# AB\*# \[\.\]\*


5. [Perl] readpipe ("expr") is used as a command to execute expr. This output returns a string in the scalar context and a list in the list context.

[Difference: system, ·, exec, readpipe]

1. Exec (@ commands );
Advantage: You can directly run external commands or scripts in the current process to capture the returned status of External commands or scripts!
Disadvantage: if an error occurs, exit the Perl script directly, and the output of @ commands cannot be captured.
2. System (@ commands) or die (error: $ ?);
Advantage: Fork sub-processes execute External commands or scripts. An error occurs in external commands or scripts, which does not affect the current process and can capture the returned status of External commands or scripts.
Disadvantage: @ commands output cannot be captured.
3. @ return = 'commands ';
Advantage: it can capture the stdout output of the script, and the external command error does not affect the current process.
4. @ return = readpipe ("commands") or die (error! $ ?) Similar to @ return = 'commands'
Advantage: it can capture stdout output, and the external command error does not affect the current process.

6. rsync



Work log-w1444

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.