os.link() Method Syntax in Python
Syntax: os.link(src, dst, *, src_dir_fd = None, dst_dir_fd = None, follow_symlinks = True)
Parameters:
- src: A path-like object representing the file system path. This is the source file path for which the hard link will be created
- dst: A path-like object representing the file system path. This is the target file path where hard link will be created. A path-like object is a string or bytes object which represents a path.
- src_dir_fd (optional): A file descriptor referring to a directory.The default value of this parameter is None. If the specified src path is absolute then this parameter is ignored. If the specified src path is relative and src_dir_fd is not None then the specified src path is relative to the directory associated with src_dir_fd.
- dst_dir_fd (optional): A file descriptor referring to a directory.
- follow_symlinks (optional) : A Boolean value.
Return type: This method does not return any value.
Python | os.link() method
os.link() method in Python is used to create a hard link. This method creates a hard link pointing to the source named destination. In this article, we will see what is os link and the uses of os.link().
Note: This method is only available on Windows and Unix platforms.