.. highlightlang:: us .. index:: FS_ReadDirectoryChanges_Create .. _fs_readdirectorychanges_create: FS_ReadDirectoryChanges_Create ============================== .. us.tag FS_ReadDirectoryChanges_Create NOTREADYGERMAN New550 FILE_MISC :ref:`FS_ReadDirectoryChanges_Create` startet die Beobachtung eines Verzeichnisses. Die Änderungen (Dateien zufügen, löschen, umbenennen) werden protokolliert und können mit der Funktion :ref:`FS_ReadDirectoryChanges_Get` abgerufen werden. .. function:: dc = FS_ReadDirectoryChanges_Create(ssDir) dc = FS_ReadDirectoryChanges_Create(ssDir, svFileFilter) dc = FS_ReadDirectoryChanges_Create(ssDir, svFileFilter, nNotify) dc = FS_ReadDirectoryChanges_Create(ssDir, svFileFilter, nNotify, bWatchSubtree) dc = FS_ReadDirectoryChanges_Create(ssDir, svFileFilter, nNotify, bWatchSubtree, bIncludeFilter) .. us.return **Returnwert** *dc* ist ein Objekt vom Typ DIRWATCHITEM oder 0, falls ein Fehler aufgetreten ist. .. us.params **Parameter** .. uparam:: ssDir *ssDir* ist das Verzeichnis, das beobachtet werden soll. .. uparam:: svFilter Ist ein String-Vektor mit Dateifiltern, siehe Beispiel. Default Filter ist "\*.\*". .. uparam:: nNotify *nNotify* ist eine ODER-Verknüpfung der folgenden Werte sein: .. list-table:: :header-rows: 1 * - Wert - Bedeutung * - FILE_NOTIFY_CHANGE_FILE_NAME - Any file name change in the watched directory or subtree causes a change notification wait operation to return. Changes include renaming, creating, or deleting a file. * - FILE_NOTIFY_CHANGE_DIR_NAME - Any directory-name change in the watched directory or subtree causes a change notification wait operation to return. Changes include creating or deleting a directory. * - FILE_NOTIFY_CHANGE_ATTRIBUTES - Any attribute change in the watched directory or subtree causes a change notification wait operation to return. * - FILE_NOTIFY_CHANGE_SIZE - Any file-size change in the watched directory or subtree causes a change notification wait operation to return. The operating system detects a change in file size only when the file is written to the disk. For operating systems that use extensive caching, detection occurs only when the cache is sufficiently flushed. * - FILE_NOTIFY_CHANGE_LAST_WRITE - Any change to the last write-time of files in the watched directory or subtree causes a change notification wait operation to return. The operating system detects a change to the last write-time only when the file is written to the disk. For operating systems that use extensive caching, detection occurs only when the cache is sufficiently flushed. * - FILE_NOTIFY_CHANGE_LAST_ACCESS - Any change to the last access time of files in the watched directory or subtree causes a change notification wait operation to return. * - FILE_NOTIFY_CHANGE_CREATION - Any change to the creation time of files in the watched directory or subtree causes a change notification wait operation to return. * - FILE_NOTIFY_CHANGE_SECURITY - Any security-descriptor change in the watched directory or subtree causes a change notification wait operation to return. Defaultwert ist FILE_NOTIFY_CHANGE_FILE_NAME. .. uparam:: bWatchSubtree Falls der Parameter TRUE (1) ist, beobachtet die Funktion auch alle Unterverzeichnisse. Falls der Parameter FALSE (0) ist, wird nur das angegebene Verzeichnis beobachtet Defaultwert ist TRUE (1). .. uparam:: bIncludeFilter Falls der Wert TRUE ist wird der Parameter *svFileFilter* als Include-Filter verwendet. Falls der Wert FALSE ist wird der Parameter *svFileFilter* als Exclude-Filter verwendet. Defaultwert ist TRUE (1). .. us.example **Beispiel** :: def MonitorDirectory() { global __g__dwi; AppKillTimer(); ssDir = "d:/test/"; if (__g__dwi == 0) { __g__dwi = FS_ReadDirectoryChanges_Create(ssDir, ["*.utx", "*.nc"]); if (__g__dwi == 0) { MessageBoxError("Cannot watch directory: %s", ssDir); return FALSE; } } smFiles = FS_ReadDirectoryChanges_Get(__g__dwi); if (smFiles[1] != "") { idx = find(smFiles[;2] == "a"); // only added svFiles = ssDir + smFiles[idx;1]; // // do something with the files. // } AppSetTimer(MonitorDirectory, 60*1000); return TRUE; } MonitorDirectory() .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Beschreibung * - 5.5.0 - Neu. .. seealso:: :ref:`uberblick-dateien`, :ref:`FS_ReadDirectoryChanges_Get`, :ref:`AppSetTimer` :sub:`id-826916`