Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Ahoi miteinander,

ich habe vermutlich Tomaten auf den Augen.

Das folgende Script (Webfundstück) soll mir die Datei x im o.a. Verzeichnis löschen.

Option Explicit


Dim objWshNetwork         'Netzwerk Objekt

Dim objWshShell            'Shell Objekt

Dim objFso            'File System Objekt

Dim objArgs            'Argumente Objekt

Dim objEnv            'Umgebungs Objekt

Dim objRegEx            'Regulärer Ausdruck


Set objWshNetwork = CreateObject("WScript.Network")

Set objWshShell = CreateObject("WScript.Shell")

Set objFso = CreateObject("Scripting.FileSystemObject")

Set objArgs = WScript.Arguments

Set objEnv = objWshShell.Environment("Process")

Set objRegEx = New RegExp


'__________________________________________________________


Dim Ordner, Datei, Erstelldatum, Datum_Akt, Diff, Quelle



Set Ordner = objFso.GetFolder("C:\temp\inventory")


For Each Datei in Ordner.Files

   Quelle = Datei.Name

   Datum_Akt = Now

   Erstelldatum = Datei.DateCreated

   Diff = Datum_Akt - Erstelldatum

   msgbox Diff

   Set Datei = objFso.GetFile("C:\temp\inventory\" & Quelle)

   If Diff > 7.0 Then

      objFso.DeleteFile Datei

   End If

Next

Das funktioniert auch prima.

Allerdings nur, wenn ich es lokal ausführe. Baue ich das ins Loginskript ein, dann tut es nicht. Warum?

Sachdienliche Hinweise bitte nicht an jede Polizeidienststelle, sondern an mich :D

Danke vorab

T

Was heißt denn bitte "es tut es nicht"?

Treten Fehler auf, wenn ja welche?

Hast du dir mal aus dem Script protokollieren lassen, welche Dateien in der For-Each-Schleife überprüft werden und mit welchem Ergebnis?

  • Autor

Ich sehe gerade, daß ich die Zeile mit Messagebox mitgepostet habe. (mein debugging für "Arme" *bg* )

Eigentlich steht nur eine Datei im Verzeichnis, die Differenz wird korrekt berechnet (laut msgbox), nur die Datei eben nicht gelöscht. :-(

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.