# Clearing a blackboard folder each time

**URL:** <https://sleuthkit.discourse.group/t/clearing-a-blackboard-folder-each-time/265>\
**Category:** Autopsy Development\
**Created:** [September 16, 2019, 1:16pm UTC](https://sleuthkit.discourse.group/t/clearing-a-blackboard-folder-each-time/265 "2019-09-16T13:16:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jpdempsey](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@jpdempsey](https://sleuthkit.discourse.group/u/jpdempsey)\
**Post date:** [September 16, 2019, 1:16pm UTC](https://sleuthkit.discourse.group/t/clearing-a-blackboard-folder-each-time/265/1 "2019-09-16T13:16:17Z")

</div>

Hi

I’m just working through more examples, adapting things to learn the framework. Sorry if my questions are a bit basic!

Every time I run/test my ingest module, it adds artefacts to the blackboard and duplicates those blackboard artefacts that it already has found (the previous time I run the module).

Is there any way of clearing out this “blackboard folder” at the start of running the module?

Thanks!

---

<div class="post-metadata">

**Author:** ![apriestman](https://yyz2.discourse-cdn.com/free1/user_avatar/sleuthkit.discourse.group/apriestman/32/24_2.png) [@apriestman](https://sleuthkit.discourse.group/u/apriestman)\
**Post date:** [September 16, 2019, 1:23pm UTC](https://sleuthkit.discourse.group/t/clearing-a-blackboard-folder-each-time/265/2 "2019-09-16T13:23:44Z")

</div>

There’s no way to clear the blackboard, but you can add a call to artifactExists() before adding your new artifact. This will stop duplication when you run multiple times.

You can see an example on line 194 here:

> <https://github.com/sleuthkit/autopsy/blob/develop/Core/src/org/sleuthkit/autopsy/modules/exif/ExifParserFileIngestModule.java>

---

<div class="post-metadata">

**Author:** ![jpdempsey](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@jpdempsey](https://sleuthkit.discourse.group/u/jpdempsey)\
**Post date:** [September 16, 2019, 2:05pm UTC](https://sleuthkit.discourse.group/t/clearing-a-blackboard-folder-each-time/265/3 "2019-09-16T14:05:33Z")

</div>

Thanks again Ann.

I’m creating python modules - and I’m guessing that this method isn’t available in the python port. I’m using Autopsy 4.12.0.

It reports "AttributeError: object has no attribute ‘artifactExists’

the code I’ve used

```
myBlackboard = Case.getCurrentCase().getServices().getBlackboard()
art = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT)
att = BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID(), 
Week18IngestModuleFactory.moduleName, blackboardFolderName)

if (myBlackboard.artifactExists(file, TSK_INTERESTING_FILE_HIT, att)):
    fileCount += 1

```

BUT…

I’ve fashioned my own way of doing this; it works although the artifactExists is probably better.

```
            alreadyHasArtifact = False;
            artifactList = file.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT)
            for artifact in artifactList:
                attributeList = artifact.getAttributes();
                for attrib in attributeList:
                    if (attrib.getDisplayString() == blackboardFolderName):
                        alreadyHasArtifact = True

```

where blackboardFolderName is the name that I also pass into BlackboardAttribute()

---

<div class="post-metadata">

**Author:** ![apriestman](https://yyz2.discourse-cdn.com/free1/user_avatar/sleuthkit.discourse.group/apriestman/32/24_2.png) [@apriestman](https://sleuthkit.discourse.group/u/apriestman)\
**Post date:** [September 16, 2019, 2:08pm UTC](https://sleuthkit.discourse.group/t/clearing-a-blackboard-folder-each-time/265/4 "2019-09-16T14:08:59Z")

</div>

We’ve recently transitioned to a new Blackboard class (the one you’re using has been deprecated). You can get it like this:

blackboard = Case.getCurrentCaseThrows().getSleuthkitCase().getBlackboard();

Once your artifact is created, you should call also call blackboard.postArtifact()

---

<div class="post-metadata">

**Author:** ![Mark\_McKinnon](https://yyz2.discourse-cdn.com/free1/user_avatar/sleuthkit.discourse.group/mark_mckinnon/32/42_2.png) [@Mark\_McKinnon](https://sleuthkit.discourse.group/u/Mark_McKinnon)\
**Post date:** [September 16, 2019, 3:41pm UTC](https://sleuthkit.discourse.group/t/clearing-a-blackboard-folder-each-time/265/5 "2019-09-16T15:41:54Z")

</div>

Hi John,

I ran into this same problem when I started doing module development so I created a plugin to delete the artifacts and attributes so I could cleanly test without have to recopy or recreate the case. You can find the plugin on my Autopsy plugin repo and the plugin is called remove\_artifacts and it is intended for developers.

Mark

---

<div class="post-metadata">

**Author:** ![jpdempsey](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@jpdempsey](https://sleuthkit.discourse.group/u/jpdempsey)\
**Post date:** [September 16, 2019, 4:01pm UTC](https://sleuthkit.discourse.group/t/clearing-a-blackboard-folder-each-time/265/6 "2019-09-16T16:01:10Z")

</div>

Thanks Mark.

I had already downloaded your plugins list from Github, but not looked at them all yet 🙂 but I have it now!
