• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 379
  • Last Modified:

How do I search for and delete 0k files on a shared volume?

I've got a NAS device with a ton of 0kb files scattered all over it - is there a tool I can use to automatically delete any file on the NAS w/ a file size of 0k?

Searching using Windows' built-in search doesn't do it because, though it find the files, it tends to break as I attempt to delete all of the results.
0
ChrisJScott
Asked:
ChrisJScott
  • 2
1 Solution
 
RickCommented:
Write this in notepad and save it with a .cmd extension.
Change "C:\MyFolder" to your path to the NAS

@ECHO OFF
FOR /R "C:\MyFolder" %%F IN (*.*) DO (
       IF "%%~zF" GTR "0" (DEL /F %%F))
EXIT /B /0
0
 
ChrisJScottAuthor Commented:
Found a great way to do it via UNIX (Mac OS X) - with the volume mounted, use:

find . -size 0k -exec rm -rf {}\:
0
 
ChrisJScottAuthor Commented:
(went off and figured this one out on my own; posting for others)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now