IT Guy
asked on
delete a folder ever 5 minutes
looking for a script to delete a folder in C:\Windows every 5 minutes. i do have a script but it seems its only successful after the PC reboots
OS : Win 8 & Win 10
OS : Win 8 & Win 10
ASKER
so here is my little story
we have malwarebytes anti-ransomware which scans our computers but malwarebytes do not have a console as yet for this product so there is no alerting if we get infected however the anti-ransomware produces a local log file that we can read through to check if we got infected.
we are trying to leverage IBM Bigfix to perform this action by creating bat script to move the file to a temp location then delete the file.
here is the script
echo off
RD /S /Q "C:\Windows\Ransomware"
we have malwarebytes anti-ransomware which scans our computers but malwarebytes do not have a console as yet for this product so there is no alerting if we get infected however the anti-ransomware produces a local log file that we can read through to check if we got infected.
we are trying to leverage IBM Bigfix to perform this action by creating bat script to move the file to a temp location then delete the file.
here is the script
echo off
RD /S /Q "C:\Windows\Ransomware"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i have a script that copies the log file to a temp location and another that reads the log file
now i need one to delete the log file :)
Copy the log file
@echo off
set Src=C:\ProgramData\Malware bytes\MBAM Service\lo gs\MBAMSER VICE.LOG
set Tgt=C:\Windows\Ransomware
for /f "tokens=*" %%a in ("%Src%") do (
xcopy "%Src%" "%Tgt%\%%~na\" /e
now i need one to delete the log file :)
Copy the log file
@echo off
set Src=C:\ProgramData\Malware
set Tgt=C:\Windows\Ransomware
for /f "tokens=*" %%a in ("%Src%") do (
xcopy "%Src%" "%Tgt%\%%~na\" /e
Maybe leave it as is?
- You have the log file.
- The folder does clear, albeit after a reboot.
- You have the log file.
- The folder does clear, albeit after a reboot.
ASKER
i used Robocopy - thanks for all your help
robocopy.exe /Mir 'C:\ProgramData\Malwarebyt es\MBAMSer vice\logs' 'C:\Windows\Ransomware\MBA MSERVICE'"
robocopy.exe /Mir 'C:\ProgramData\Malwarebyt
And are you using Windows Scheduler to run it every 5 minutes, that would seem like the most straight forward approach.
~bp