如何复制日志月份 [英] How to copy logs month wises

查看:63
本文介绍了如何复制日志月份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个文件夹,其中包含过去1年的日志。我希望每个月将这个日志复制到一个新的文件夹中。例如我的january文件应该包含jan的所有日志。

就像我希望它每个月都要做的那样。任何人都可以帮助我。在此先感谢。

Hello all,

I have a folder which has logs of past 1 year in it day wise. I want to copy this log in a new folders month wise. for example my january file should have all the logs of jan.
like that i want it to do for every month . can any body help me on this. Thanks in advance.

推荐答案

@echo off



::循环浏览不同文件夹列表



for / f %% a in(folderlist.txt)do(

echo %% a



@echo关闭

设置src = D:\ folder \copyingfrom \ %% a \Processing

setdest = D:\ folder \copiedto \ %% a \Processing\MonthWise

for %% F in(%src%\ *)do(

for / ftokens = 1,2,3 delims = /%% A in(%%〜tF)do(

如果不存在%dest%\ %% C _ %% Amkdir%dest%\ %% C _ %% A

:: move%% ~fF%dest%\ %% C _ %% A

xcopy / Y%% ~fF%dest%\ %% C _ %% A





@echo off

:: Looping through the list for different folders

for /f %%a in (folderlist.txt) do (
echo %%a

@echo off
set "src=D:\folder\copyingfrom\%%a\Processing"
set "dest=D:\folder\copiedto\%%a\Processing\MonthWise"
for %%F in ("%src%\*") do (
for /f "tokens=1,2,3 delims=/ " %%A in ("%%~tF") do (
if not exist "%dest%\%%C_%%A" mkdir "%dest%\%%C_%%A"
::move "%%~fF" "%dest%\%%C_%%A"
xcopy /Y "%%~fF" "%dest%\%%C_%%A"
)
)
)


这篇关于如何复制日志月份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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