自动备份学习资料,超过3天的删除.bat

@echo off
setlocal enabledelayedexpansion

REM ����ԴĿ¼��Ŀ��Ŀ¼
set "sourceDir=C:\OneDrive - mail.jxust.edu.cn\ѧϰ����"
set "targetDir=C:\�ļ�\ѧϰ���ϱ���"

REM ��ȡ��ǰ���ں�ʱ��
for /f "tokens=2-4 delims=/ " c-b"
)

for /f "tokens=1-2 delims=: " a%%b"
)

REM ����Ŀ���ļ�������
set "targetFolder=%targetDir%\ѧϰ����%currentDate%%currentTime%"

REM ����Ŀ���ļ���
mkdir "%targetFolder%"

REM �����ļ�
xcopy "%sourceDir%*" "%targetFolder%" /E /Y

echo ������ɣ�

REM ɾ������3��ı���
forfiles /p "%targetDir%" /m ѧϰ����_* /d -3 /c "cmd /c if @isdir==TRUE rd /S /Q @file"

echo ɾ������7��ı�����ɣ�
pause