重命名/备份文件的正确方法
我经常对 access 和 Excel 文件宏和数据库进行更改。在修改文件之前我通常会做的是复制该文件并将其重命名为filename_todaysdate.ext
。这是正确/最安全的做事方式吗?
i am constantly making changes to access and excel file macros and databases. what i usually do before i modify the file is i make a copy of the file and rename it to the filename_todaysdate.ext
. is this the proper/safest way of doing things?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只要你保持一致并且每个人都了解系统,任何方法都可以是“正确”的方法。
也就是说,我会更改扩展名:
filename_date_ext.old
,并将备份文件移动到明确标记为“备份”的文件夹中,以便轻松整理备份并防止意外使用旧数据。毕竟,某些原始文件名也可能包含日期!Any way can be the 'right' way as long as you are consistent and everyone knows the system.
That said, I would change the extension:
filename_date_ext.old
and moving the backup files to a folder clearly marked 'backup' in order to easily sort out the backups and prevent accidental use of old data. After all, some original filenames may contain the date too!您的备份策略基于复制整个 Excel 或 Access 文件...这可能正好满足您的要求。我不怎么使用 Excel,但使用 Access 很多时候我更喜欢仅保存选定的部分,而不是整个 MDB 的完整副本。您可以想象大型 MDB 的多个副本会消耗多少磁盘空间……例如数百兆字节。
您可以使用未记录的 SaveAsText 方法将单个数据库对象保存到文本文件:
O'Reilly 的 Access Cookbook 提供了另一种备份数据库对象的精细方法。请参阅秘诀 6.8 将选定的对象备份到另一个数据库
Your backup strategy is based on copying the entire Excel or Access file ... which may be just fine for your requirements. I don't do much Excel, but with Access there are many times I prefer saving just selected pieces rather than a complete copy of the entire MDB. You can imagine how much disk space would be consumed by multiple copies of a large MDB ... say hundreds of megabytes, for example.
You can use the undocumented SaveAsText method to save individual database objects to text files:
O'Reilly's Access Cookbook offers another granular approach to backing up database objects. See Recipe 6.8 Back Up Selected Objects to Another Database