Solved

delete a folder ever 5 minutes

Posted on 2016-09-12
6
84 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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
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.

739 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