Announcement

Collapse
No announcement yet.

Server storage management

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Server storage management

    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:

    Code:
    $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
    A

    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}

    How can i write it for powershell?

    $Dir="C:\Test"
    $Et1="0"
    $Et2="9"
    foreach( $In in(Get-ChildItem $Dir -Recurse)){ #per ogni cartella in $Dir
    if(!(Get-ChildItem -Path $In.FullName)){ #se non hai figli
    $Sav=Split-Path( $In ) -leaf; #prendi il nome della cartella
    if(!($Sav.StartsWith($Et1)) -and (!($Sav.StartsWith($Et2)))){ #se non fa parte delle eccezioni
    echo $In.FullName; #stampa
    #Remove-Item $In.FullName
    }
    }
    }
    maybe
    Last edited by Albiz; 19th November 2013, 15:18. Reason: [SOLVED]
Working...
X