Jump to content

Server storage manager


Albiz

Recommended Posts

Hi guys!

Today i'm working on a VM with Windows server 2008 R2, the role is File services, file server and file server resource manager are installed.

I want to do those things, scheduled if possible:

  • Delete empty folders
  • Create a report for duplicate files
  • Delete temprary files

For the first problem i've created a script:

$Dir="C:\Test" foreach( $In in(Get-ChildItem $Dir -Recurse)){if(!(Get-ChildItem -Path $In.FullName)){echo $In.FullName;Remove-Item $In.FullName}}

for the last problem i used File management tasks creating a role for each extension.

what about the second problem? Nothing i've done... suggestions?

Thanks :thumbup

A

Link to comment
Share on other sites


:blushing: i've got some folder, like 00-Doc, starting with numbers; Those folders MUST NOT BE DELETED.

I think this

if(Folder start with(list)){skip}
$Dir="C:\Test" $Et1="0"$Et2="9"foreach( $In in(Get-ChildItem $Dir -Recurse)){ #per ogni cartella in $Dirif(!(Get-ChildItem -Path $In.FullName)){ #se non hai figli$Sav=Split-Path( $In ) -leaf; #prendi il nome della cartellaif(!($Sav.StartsWith($Et1)) -and (!($Sav.StartsWith($Et2)))){ #se non fa parte delle eccezioniecho $In.FullName; #stampa#Remove-Item $In.FullName}}}

maybe

Edited by Albiz
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...