当名称每天更改时,如何在R中上传文件
我有一个需要每天上传的文件,文件名mis_01_10062022.xlsx
。每天MIS_01 _
文件名的一部分是常数日期零件 - 10062022
日期更改。我如何每天上传该文件,每天选择它?是否可以通过仅提及文件名为mis_01 _*
来选择文件。
I have a file that needs to be uploaded each day, file name MIS_01_10062022.xlsx
. Each day MIS_01_
part of the file name is constant the date part - 10062022
changes due to date. How can I upload this file with out selecting it each day? Is it possible to select file by just mentioning the file name as MIS_01_*
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是您可以尝试的策略:
a< -list.files(atterat =“ mis_01_”)
b< -file.info(a)
fiva
最新> fimate_file_index< -which.max(b $ mtime)
。这将返回最新文件的索引,您可以通过最新_FILE_NAME< -a [festment_file_index]
再次在初始变量A中访问该索引。Here is a strategy of what you could try:
a<-list.files(pattern="MIS_01_")
b<-file.info(a)
latest_file_index<-which.max(b$mtime)
. This will return the index of the newest file, which you can again access in your initial variable a, vialatest_file_name<-a[latest_file_index]