diff --git a/files/ajax/scan.php b/files/ajax/scan.php
index dec949a819bcb4fe51081b4e380f0d1c336b2916..01236c83da1d72c166551318655b2bbccb0cf11a 100644
--- a/files/ajax/scan.php
+++ b/files/ajax/scan.php
@@ -2,15 +2,18 @@
 
 require_once '../../lib/base.php';
 
+$eventSource=new OC_EventSource();
+
 $force=isset($_GET['force']) and $_GET['force']=='true';
 $checkOnly=isset($_GET['checkonly']) and $_GET['checkonly']=='true';
 
 //create the file cache if necesary
 if($force or !OC_FileCache::inCache('')){
 	if(!$checkOnly){
-		OC_FileCache::scan('');
+		OC_FileCache::scan('',false,$eventSource);
 	}
-	OC_JSON::success(array("data" => array( "done" => true)));
+	$eventSource->send('success',true);
 }else{
-	OC_JSON::success(array("data" => array( "done" => false)));
-}
\ No newline at end of file
+	$eventSource->send('success',false);
+}
+$eventSource->close();
\ No newline at end of file
diff --git a/files/js/files.js b/files/js/files.js
index 649f193aa2d4f751c5c9fc0d1b0667d80c087505..28259606ceae8a0cecc13bed470fb19648b5a00b 100644
--- a/files/js/files.js
+++ b/files/js/files.js
@@ -348,13 +348,17 @@ $(document).ready(function() {
 function scanFiles(force){
 	force=!!force; //cast to bool
 	$('#scanning-message').show();
-	$.get(OC.filePath('files','ajax','scan.php'),{force:force}, function(response) {
-		if(response && response.data && response.data.done){
+	var scannerEventSource=new OC.EventSource(OC.filePath('files','ajax','scan.php'),{force:force});
+	scannerEventSource.listen('scanned',function(file){
+		console.log(file);//TODO: make this into proper feedback
+	});
+	scannerEventSource.listen('success',function(success){
+		if(success){
 			window.location.reload();
 		}else{
-			alert('error')
+			alert('error while scanning');
 		}
-	}, "json");
+	});
 }
 
 function boolOperationFinished(data, callback) {
diff --git a/lib/filecache.php b/lib/filecache.php
index 928fc02e669e09f50df39736ac844442c2e70ec6..4e458ad929a28c13cd8c8a70097e9b594ba4fd8a 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -288,8 +288,9 @@ class OC_FileCache{
 	 * recursively scan the filesystem and fill the cache
 	 * @param string $path
 	 * @param bool $onlyChilds
+	 * @param OC_EventSource $enventSource
 	 */
-	public static function scan($path,$onlyChilds=false){//PROBLEM due to the order things are added, all parents are -1
+	public static function scan($path,$onlyChilds,$eventSource){//PROBLEM due to the order things are added, all parents are -1
 		$dh=OC_Filesystem::opendir($path);
 		$stat=OC_Filesystem::stat($path);
 		$mimetype=OC_Filesystem::getMimeType($path);
@@ -305,12 +306,13 @@ class OC_FileCache{
 				if($filename != '.' and $filename != '..'){
 					$file=$path.'/'.$filename;
 					if(OC_Filesystem::is_dir($file)){
-						self::scan($file,true);
+						self::scan($file,true,$eventSource);
 					}else{
 						$stat=OC_Filesystem::stat($file);
 						$mimetype=OC_Filesystem::getMimeType($file);
 						$stat['mimetype']=$mimetype;
 						self::put($file,$stat);
+						$eventSource->send('scanned',$file);
 						$totalSize+=$stat['size'];
 					}
 				}