我们有一个/ tmp文件夹供人们用于临时性的东西。 它可以是任何文件和任何文件。
我们要这样做,以便自动删除(或最好是移动到同一个共享驱动器上的另一个文件夹)在过去两周内没有被访问过的所有文件。 这应该每周发生一次,我不必手动做。
有没有这样的软件? 任何人都可能有一个脚本?
服务器2008R2
get-childitem -Path "<location of tmp folder>" | where-object {$_.LastWriteTime -lt (get-date).AddDays(-15)} | move-item -destination "<destination>"
此Powershell脚本将移动超过2周的文件。