Python writes call shell command script

Source: Internet
Author: User

  • Os.listdir ("/") ==ls
  • Shutil.copy (src,dest) ==cp src refers to source file
  • Shutil.copy2 (src,dest) Copy2copy2 also replicates the last access time and last update time.
  • Shutil.copytree (Src,dst[,symlinks]) copies the directory, symlinks, which is a Boolean value and creates a symbolic link if it is true.
  • Shutil.move (SRC,DST) ==MV
  • Os.chdir (dirname) switch the current working directory to DirName
  • OS.GETCWD () returns the current working directory path
  • Os.chroot (dirname) takes dirname as the root directory of the process. Similar to the chroot command under *nix
  • Os.chmod (Path,mode) changes the permission bit of path. Mode can be a combination of the following values (using OR):
  • Os.chown (path,uid,gid) changes the owner of the file. The UID and GID are-1 without altering the original owner.
  • Os.link (SRC,DST) Creating a hard connection
  • Os.mkdir (Path,[mode]) to create a directory. Meaning of mode see Os.chmod (), default is 0777
  • Os.makedirs (Path,[mode]) is similar to Os.mkdir (), but a nonexistent parent directory is created first.
  • < EM id= "__mcedel" > os.readlink (path) returns the path that this symbolic link points to
  • < EM id= "__mcedel" > o S.remove (path) Delete file, cannot be used to delete directory
  • < EM id= "__mcedel" > < EM id= "__mcedel" >os.rmdir (path) Delete folder, cannot be used to delete file
  • < EM id= "__mcedel" > os.symlink ( SRC,DST) Create Symbolic Links
  • Shutil.rmtree (Path[,ignore_errors[,onerror])
  • Os.environ (environment variable)

Python writes call shell command script

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.