Python/File System
< Python
Jump to navigation
Jump to search
| TODO | CODE |
|---|---|
| Read/Write file mtime |
import os.path
mtime = os.path.getmtime('filename')
|
| Copy/Move file |
import shutil
shutil.copy(src, dst)
shutil.move(src, dst)
|
| Path conversion |
import os.path
CODE_PATH = os.path.realpath(os.path.dirname(__file__)) + '/'
DATA_PATH = os.path.expanduser('~/osm-data/')
|
| List directory |
import os.path
items = os.path.listdir()
for i in items:
print(i)
|