为cronjob自动设置文件的名称
我拥有以下我设置的Cronjob,可以通过Putty运行Python脚本。该脚本下载一些数据,将其导入到CSV(作为参数给出的文件)并将其推向我的GitHub:
0 16 * * * python3 UnderdogADP.py ud_adp_05022022.csv && git add ud_adp_05022022.csv && git commit -m "Updated ADP" && git push >> adp.log
有没有办法根据日期动态更改文件名更改?例如,我希望今天的文件名是UD_ADP_05032022.CSV,明天有UD_ADP_05042022.CSV等吗?感谢您的帮助!
I have the following cronjob that I have set up to run a Python script through PuTTY. The script downloads some data, imports it to a csv (the file that is given as an argument) and pushes it to my Github:
0 16 * * * python3 UnderdogADP.py ud_adp_05022022.csv && git add ud_adp_05022022.csv && git commit -m "Updated ADP" && git push >> adp.log
Is there a way to have the filename change dynamically based on the date? For example, I would want the filename today to be ud_adp_05032022.csv and tomorrow have it be ud_adp_05042022.csv, etc.? Thanks for the help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我能够使用此语法来解决它:
I was able to fix it with this syntax: