Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

delete a folder ever 5 minutes

Posted on 2016-09-12
6
Medium Priority
?
94 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 57

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 57

Accepted Solution

by:
Bill Prew earned 2000 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
Are your AD admin tools letting you down?

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 25

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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

When asking a question in a forum or creating documentation, screenshots are vital tools that can convey a lot more information and save you and your reader a lot of time
Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

688 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