Module pl.file
File manipulation functions: reading, writing, moving and copying.
Dependencies: pl.utils, pl.dir, pl.path
Functions
read (filename) | return the contents of a file as a string |
write (filename, str) | write a string to a file |
copy (src, dest, flag) | copy a file. |
move (src, dest) | move a file. |
access_time (path) | Return the time of last access as the number of seconds since the epoch. |
creation_time (path) | Return when the file was created. |
modified_time (path) | Return the time of last modification |
delete (path) | Delete a file |
Functions
- read (filename)
-
return the contents of a file as a string
Parameters:
- filename string The file path
Returns:
-
file contents
- write (filename, str)
-
write a string to a file
Parameters:
- copy (src, dest, flag)
-
copy a file.
Parameters:
- src string source file
- dest string destination file
- flag bool true if you want to force the copy (default)
Returns:
-
true if operation succeeded
- move (src, dest)
-
move a file.
Parameters:
Returns:
-
true if operation succeeded, else false and the reason for the error.
- access_time (path)
-
Return the time of last access as the number of seconds since the epoch.
Parameters:
- path string A file path
- creation_time (path)
-
Return when the file was created.
Parameters:
- path string A file path
- modified_time (path)
-
Return the time of last modification
Parameters:
- path string A file path
- delete (path)
-
Delete a file
Parameters:
- path string A file path