diff --git a/lib/private/files/storage/temporary.php b/lib/private/files/storage/temporary.php
index d84dbda2e39dd844e68ddf0c9bad7cfb2206fe3c..7547640f17519e2ef1c26aa5f29837021e2d22ea 100644
--- a/lib/private/files/storage/temporary.php
+++ b/lib/private/files/storage/temporary.php
@@ -24,4 +24,8 @@ class Temporary extends Local{
 		parent::__destruct();
 		$this->cleanUp();
 	}
+
+	public function getDataDir() {
+		return $this->datadir;
+	}
 }
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index b2e0b59d8e659b3051dc00fe7954b294ff3669bc..8eca55d1fdf5ca0f4e05f4e29498defd123c0e8a 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -669,7 +669,6 @@ class View extends \PHPUnit_Framework_TestCase {
 
 		$rootView = new \OC\Files\View('');
 
-
 		if ($param0 === '@0') {
 			$param0 = $longPath;
 		}
@@ -681,6 +680,9 @@ class View extends \PHPUnit_Framework_TestCase {
 
 		call_user_func(array($rootView, $operation), $longPath, $param0);
 
+		if (!\OC_Util::runningOnWindows()) {
+			system('rm -rf ' . escapeshellarg($storage->getDataDir()));
+		}
 	}
 
 	public function tooLongPathDataProvider() {