Solved

delete a folder ever 5 minutes

Posted on 2016-09-12
6
79 Views
Last Modified: 2016-09-13
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
0
Comment
Question by:NxJNY
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 54

Expert Comment

by:Bill Prew
ID: 41794287
What is the script you are using currently?

And are you using Windows Scheduler to run it every 5 minutes, that would seem like the most straight forward approach.

~bp
0
 
LVL 2

Author Comment

by:NxJNY
ID: 41794296
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"
0
 
LVL 54

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 41794304
My guess would be that once the anti-malware utilities are running they have that folder "locked" or open for access and Windows can not remove it them.  Whent the BAT script runs (run it from a stand alone command prompt for a test) what error message does it display?

~bp
0
Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

 
LVL 2

Author Comment

by:NxJNY
ID: 41794499
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\Malwarebytes\MBAMService\logs\MBAMSERVICE.LOG
set Tgt=C:\Windows\Ransomware
for /f "tokens=*" %%a in ("%Src%") do (
   xcopy "%Src%" "%Tgt%\%%~na\" /e
0
 
LVL 24

Expert Comment

by:NVIT
ID: 41794589
Maybe leave it as is?
- You have the log file.
- The folder does clear, albeit after a reboot.
0
 
LVL 2

Author Comment

by:NxJNY
ID: 41796744
i used Robocopy - thanks for all your help

robocopy.exe /Mir 'C:\ProgramData\Malwarebytes\MBAMService\logs' 'C:\Windows\Ransomware\MBAMSERVICE'"
0

Featured Post

Don't miss ATEN at NAB Show April 24-27!

Visit ATEN at NAB Show to learn how our "Seamlessly Entertaining" solutions deliver fast, precise video streaming without delays for the broadcasting and media environment. ATEN will showcase its 16x16 Modular Matrix Switch (VM1600) and KVM Over IP Solution (KE6900 series).

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to record audio from input sources to your PC ā€“ connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 ā€“ both 32 bit & 64.
An article on effective troubleshooting
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial sā€¦
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question