如何移动文件超过30天的存档位置和存档位置存档的文件吗? [英] How to move files older than 30 days to archive location and archive the files in archive location?

查看:127
本文介绍了如何移动文件超过30天的存档位置和存档位置存档的文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须写一个Windows批处理脚本以下情形:

I have to write a Windows batch script for the following scenario:

我的日志文件present文件夹 D:\\测试以.txt格式。我有一个名为另一个文件夹D:\\测试\\存档

I have log files present in folder D:\Test in .txt format. And I have another folder named D:\Test\archive.

我要移动的文件超过30天的存档文件夹 D:\\测试\\存档然后我有存档的所有文件present在 D:使用\\测试\\档案馆来一个ZIP文件中的 WinRAR的

I have to move the files older than 30 days to archive folder D:\Test\archive and then I have to archive all the files present in D:\Test\archiv to a single zip file using WinRAR.

我的zip文件应该在格式 ARCHIVE_SYSDATE

My zip file should be in the format ARCHIVE_SYSDATE.

推荐答案

有没有必要超过30天移动文件到子文件夹归档它们。的 WinRAR的的有内置的选项,直接进入旧文件x天/小时/分钟到归档文件。

There is no need to move the files older than 30 days to a subfolder for archiving them. WinRAR has built-in options to move files older than x days/hours/minutes directly into an archive file.

开始的 WinRAR的的,点击菜单中的帮助帮助主题并选择标签的内容即可。还有就是列表项的命令行模式语法的和子项的命令开关各主要页面的命令行包含一个链接到的所有命令,所有开关的字母列表。

Start WinRAR, click in menu Help on Help Topics and select tab Contents. There is the list item Command line mode with main page Command line syntax and with the subitems Commands and Switches each containing a link to an alphabetic list of all commands and all switches.

从的按字母顺序排列的命令列表的为你的任务是最有用的命令是:

From Alphabetic commands list the most useful command for your task is:

M 移动文件和文件夹归档

m move files and folders to an archive

从的按字母顺序切换列表的为你的任务是最有用的开关是:

From Alphabetic switches list the most useful switches for your task are:

-ag [格式] 使用当前日期和时间,结果生成压缩文件名
   -cfg - 忽略默认的配置文件和环境变量的结果
   -ep1 排除基地名称的文件夹结果
   -ibck 在后台运行搜索的WinRAR
   -m< N> 组COM pression方法结果
   -r - 禁用递归结果
   -to<时间> 工艺比指定时间结果旧文件
   -y 假设是对所有查询

-ag[format] generate archive name using the current date and time
-cfg-             ignore default profile and environment variable
-ep1             exclude base folder from names
-ibck            run WinRAR in background
-m<n>          set compression method
-r-                 disable recursion
-to<time>    process files older than the specified time
-y                  assume Yes on all queries

从把帮助所有信息的 WinRAR的的共同命令使用方法是:

Putting all the information from help of WinRAR together the command to use is:

"%ProgramFiles%\WinRAR\WinRAR.exe" m -agYYYY-MM-DD -cfg- -ep1 -ibck -m5 -r- -to30d -y D:\Test\archive\ARCHIVE_.zip D:\Test\*

注:转换 -y 也将禁用所有错误消息的输出

Note: Switch -y disables also output of all error messages.

这篇关于如何移动文件超过30天的存档位置和存档位置存档的文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆