# 获取备份的文件名

**URL:** <https://meta.discourse.org/t/get-the-filename-of-the-backup/151802>\
**Category:** Support\
**Created:** [2020年五月18日 09:35 UTC](https://meta.discourse.org/t/get-the-filename-of-the-backup/151802 "2020-05-18T09:35:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pihentagy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pihentagy/32/131067_2.png) [@pihentagy](https://meta.discourse.org/u/pihentagy)\
**Post date:** [2020年五月18日 09:35 UTC](https://meta.discourse.org/t/get-the-filename-of-the-backup/151802/1 "2020-05-18T09:35:20Z")

</div>

你好！

我想自动化以下操作：通过脚本创建备份，并将备份复制到其他地方。

有没有一种易于解析的方式来获取当前备份的文件名？（我知道备份过程会输出创建的文件名，但这并不便于机器读取）或者，我应该直接写一个单行命令来找出备份目录中最新的文件？

谢谢，  
Gergő

---

<div class="post-metadata">

**Author:** ![rishabh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rishabh/32/179446_2.png) [@rishabh](https://meta.discourse.org/u/rishabh)\
**Post date:** [2020年五月18日 09:43 UTC](https://meta.discourse.org/t/get-the-filename-of-the-backup/151802/2 "2020-05-18T09:43:41Z")

</div>

> [@pihentagy](#):
>
> 有没有一种易于解析的方法来查找当前的备份文件名？

```plaintext
./launcher enter app
discourse restore

```

该命令将输出所有可用的备份，且其中的文件名已包含一致的日期信息，便于排序。这样可以吗？

---

<div class="post-metadata">

**Author:** ![pihentagy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pihentagy/32/131067_2.png) [@pihentagy](https://meta.discourse.org/u/pihentagy)\
**Post date:** [2020年五月19日 12:29 UTC](https://meta.discourse.org/t/get-the-filename-of-the-backup/151802/3 "2020-05-19T12:29:34Z")

</div>

谢谢，那意思是我得写个 shell 单行命令来查找最新的文件。

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2020年六月18日 12:35 UTC](https://meta.discourse.org/t/get-the-filename-of-the-backup/151802/4 "2020-06-18T12:35:12Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
