restorething是一个用于从syncthing版本控制存档还原文件的工具

restorething的Python项目详细描述


restorething是用于从同步对象还原文件的工具 版本控制存档。提供同步对象的路径restorething。 版本控制目录和日期,它将索引 版本控制为您存档和还原文件。

restorething具有多种还原模式和筛选功能 文件和目录。

恢复模式

restorething将使用以下模式还原文件

  • 特定日期/时间之前/之后最近的文件(默认行为)
  • 特定日期/时间之前最近的文件
  • 特定日期/时间之后最近的文件
  • 没有日期/时间限制的特定文件的所有实例

restorething有过滤选项

  • 使用特定字符串筛选文件
  • 使用特定字符串筛选目录
  • 用特定字符串过滤dir和file

安装

restorething来自源代码

$ python setup.py sdist
$ pip install dist\restorething-x.x.x.tar.gz

restorething来自pypi

$ pip install restorething

用法

$ python -m restorething { date [ -hr{0-24} | -b | -a | -pm {int} | -ai {path and filename} | -vd {dir} | -rd {dir} | -dd {dir} | -df {filename} | -nf | -nd | -ic | -ns | [ -ff {string} | -fd {string} | -fb {path and filename} ] | -d | --version] }

ArgumentTypeFormatDefaultDescription
dateintegerYYYYMMDDNo default value. Field must be supplied by userDate to restore files, date will be used to find closest file before or after date
-hrinteger-hr {0-24}12Hour to compare file’s modification time
-bswitch-bdisabledLimit restore of files to before the supplied date and hour
-aswitch-adisabledLimit restore of files to after the supplied date and hour
-pminteger-pm {0-2147483647 hrs}0Limit restore of files to plus/minus hours each side of the supplied date and hour
-aistring-ai {absolute path of file}disabledRecovers all versions of a file ignoring any date and times specified
-vdstring-vd {absolute or relative path of DIR}.stversionsSets the location of the syncthing versioning folder, by default script looks in directory script is run from
-rdstring-rd {absolute or relative path of DIR}restoreEnables the ability to restore to a location other than the default
-ddstring-dd {absolute or relative path of DIR}/home/name/.restorethingEnables the ability to use a database file in a different location, default behaviour is to store database file in users home directory
-dfstring-df {filename}restorething.dbEnables the ability to use a database file with a different name
-nfswitch-nfdisabledEnables indexing archived files every time script is run, by default script will reuse existing DB file for 24 hours
-ndswitch-nddisabledEnables restoring files that have been deleted or changed due to renaming, by default deleted or renamed files are not included in restore
-icswitch-icdisabledEnables restoring files that were marked as conflict files by syncthing and deleted by user, by default conflict files are not restored
-nsswitch-nsdisabledEnables no simulation mode, default behaviour is to simulate restore, no simulation mode will copy files from syncthing archive to hard drive
-ffstring-ff {string}disabledRecovers a single version of any files matching the string supplied
-fdstring-fd {string}disabledRecovers a single version of all files in any DIR matching the string supplied
-fbstring-fb {absolute path of file}disabledRecovers a single version of a file matching the DIR and Filename
-dswitch-ddisabledEnables debug output to console
–versionswitch–versiondisabledDisplays version

默认行为

  • 脚本的默认行为是查找最接近的文件 比提供的日期/时间早(早)。如果什么都找不到, 脚本查找比提供的文件年轻(之后)的最近文件 日期/时间。默认行为可以限制为正负小时 通过提供-pm {hours}参数或更改为仅查找 在提供的日期/时间之前或之后,使用-b-a 分别标记。
  • 如果未提供小时,则脚本使用的默认时间值为 下午12点。这可以通过使用-hr{0-24}参数进行更改
  • 默认情况下,该脚本将始终模拟还原,为用户提供 查看任何检测到的警告的机会。通过提供-ns 标记,用户可以启用“无模拟”模式并执行 还原,不模拟,不撤消。
  • 脚本将在 正在从中调用脚本并递归还原内部的所有文件 其中
  • 如果未提供同步版本控制目录,则默认 行为是在调用脚本的目录中查找 从。
  • 所有配置、日志和数据库文件都存储在用户家中 目录下名为.restorething的目录。

示例

如果找不到文件,请在2016年8月15日早上6点之前还原最近的文件 2016年8月15日早上6点后恢复壁橱文件。由于不供应 版本控制目录,需要从目录调用脚本 包含版本控制目录

$ python -m restorething 20160815 -hr 6

在2016年8月15日早上6点之后恢复最近的文件,如果没有找到文件,则没有 将还原文件。版本控制目录作为相对目录提供 从中调用脚本的路径。

$ python -m restorething 20160815 -hr 6 -a -vd sync/.stversions

在2016年8月15日早上6点之前恢复最近的文件,如果没有找到文件, 不会还原任何文件。版本控制目录作为相对目录提供 从中调用脚本的路径。

$ python -m restorething 20160815 -hr 6 -b -vd sync/.stversions

在2016年8月15日上午6点之前不超过10小时恢复最近的文件, 如果找不到文件restorething将查找壁橱文件否 2016年8月15日早上6点后超过10小时。版本控制目录是 作为调用脚本的相对路径提供。

$ python -m restorething 20160815 -hr 6 -pm 10 -vd sync/.stversions

还原目录中文件的所有实例 /some/important/directory/,命名为file.txt。当前脚本 限制是你必须提供一个日期,尽管它将被忽略。

$ python -m restorething 20160815 -ai /some/important/directory/file.txt

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
在ElasticSearch中将SearchHit转换为Java对象   第三方库类的java重写XmlAdapter   java如何使用动画类获得平滑的动画效果?   Java PDFBox如果文本内容超过PDF的第一页,如何添加新页面?   Java二叉搜索树u根到最近叶的距离   java什么是diff Scanner和BufferedReader   java如何设计不生成并行数组的程序   java多次声明变量会降低执行速度吗?   java如何使用JXLAPI读取下拉列表的值   多线程为什么自定义阻塞队列在Java中不是线程安全的   java在一个变量中每输入1000个单位,就从另一个变量中减去1?   java Mapstruct通用映射器   Java中的类能否确定它是否已被修改?   java如何在MogoOperations聚合函数中定义输出类型?