# ExportText proc (savefile)

Source: https://ref.dm-lang.org/savefile/proc/ExportText

### Format
> `savefile.ExportText(path=cd,file)`

### Args
- `path`: the path to export
- `file`: optional file to write to


Converts all or part of a savefile to a human readable text format, similar in syntax to DM. If no file is specified, the savefile text is returned as a text string instead of being written to a file.

The following example shows how to export and later import a savefile. The user's mob is written into a directory with the same name as their [ckey](https://ref.dm-lang.org/mob/var/ckey.md) and the result is written to a text file.

```dm /ExportText/
mob/verb/write()
   var/savefile/F = new()
   var/txtfile = file("players/[ckey].txt")

   F[ckey] << usr

   fdel(txtfile)
   F.ExportText("/",txtfile)

   usr << "Your savefile looks like this:"
   usr << "<pre>[html_encode(file2text(txtfile))]</pre>"

mob/verb/read()
   var/savefile/F = new()
   var/txtfile = file("players/[ckey].txt")

   F.ImportText("/",txtfile)
   F[ckey] >> usr
```

### See also
> [ImportText proc (savefile)](https://ref.dm-lang.org/savefile/proc/ImportText.md)
