?
Solved

Find and delete zero filesize file with SCOM

Posted on 2016-09-20
4
Medium Priority
?
40 Views
Last Modified: 2016-11-05
Hi Experts,

I would like to find and delete zero filesize file in a particular folder with SCOM management pack.
Could you please advise the best way of achieving this?
0
Comment
Question by:jianny
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 16

Accepted Solution

by:
vivigatt earned 1000 total points
ID: 41807765
SCOM is not required. You can use this batch file :

@echo off

setlocal enabledelayedexpansion

set "SEARCH_DIR=%~1"
set FILE_SIZE=0

if not exist "%SEARCH_DIR%" (
    echo Usage: %~nx0 directory 
    echo Lists all files in given directory and its subdirectories that have a zero size
    echo.
    echo "%SEARCH_DIR%" does not exist.
    exit /b 1
)

for /R "%SEARCH_DIR%" %%F in (*) do (
    if exist "%%F" if %%~zF EQU %FILE_SIZE% echo %%F
)

Open in new window

0
 
LVL 18

Expert Comment

by:Mike T
ID: 41807806
*cough* powershell. Message ends.
0
 
LVL 30

Assisted Solution

by:serialband
serialband earned 1000 total points
ID: 41808013
Get-Childitem "PathToFiles" | where {$_.length -eq 0} | remove-Item

Get-Childitem -Recurse | % {
  if(!$_.PSIsContainer -and $_.length -eq 0) {
    write-host ("{0}: {1}" -f $_.FullName, $_.length) | remove-item
   }
}
0

Featured Post

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This tutorial will walk an individual through the process of installing of Data Protection Manager on a server running Windows Server 2012 R2, including the prerequisites. Microsoft .Net 3.5 is required. To install this feature, go to Server Manager…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question