I have written a piece of code that notifies if something is added or removed from a folder location:from PyQt4 import QtGuifrom PyQt4 import QtCoreimport sysimport osdef xor(lst1, lst2):     returns a tuple of items of item not in either of lists        x = lst2 if len(lst2) > len(lst1) else lst1    y = lst1 if len(lst1) < len(lst2) else lst2    return tuple(item for item in x if item not in y)class MyMainWindow(QtGui.QMainWindow):    def __init__(self, pathToWatch=None, parent=None):        super(MyMainWindow, self).__init__(parent)        self.setupUi()        self._pathToWatch = pathToWatch or /Users/ppl/Desktop/testFolder        self._initialContent = os.listdir(self._pathToWatch)        self._fileSysWatcher    = QtCore.QFileSystemWatcher()        self._fileSysWatcher.addPath(self._pathToWatch)        self.connectSignals()    def connectSignals(self):        QtCore.QObject.connect(self._fileSysWatcher, QtCore.SIGNAL(directoryChanged(QString)),            self,      QtCore.SLOT(slotDirChanged(QString)))    def setupUi(self):        self.label = QtGui.QLabel(Watching folder)        self.setCentralWidget(self.label)        self.setWindowTitle(Detect Dir Change)    @QtCore.pyqtSlot(QString)       def slotDirChanged(self, path):        newContent = ''.join(xor(os.listdir(path), self._initialContent))        self._initialContent = os.listdir(path)        msg =         if newContent not in self._initialContent:            msg = removed: %s % newContent        else:            msg = added: %s %  newContent        self.label.setText(Detected Directory Change!! \n %s % msg)def main():      app         = QtGui.QApplication(sys.argv)    window      = MyMainWindow()    window.show()    window.raise_()    return sys.exit(app.exec_())if __name__ == '__main__':  main()I have used QFileSystemWatcher that notifies that the change happened and then I recheck the content to compare with the difference.
Directory watcher and notifier for files added or removed
python;pyqt