Solved

To find the free disk space of a particular folder and to delete old files using PowerShell and Java

Posted on 2016-09-19
2
18 Views
Last Modified: 2016-10-18
To find the free space of a particular folder/folders
 and to delete old files if that folder exceeds a particular threshold size limit.
It should work on local machine as well as remotely.

Can anyone please help in this regard.
0
Comment
Question by:Kartheek M
2 Comments
 
LVL 27

Accepted Solution

by:
serialband earned 500 total points
ID: 41805136
You don't find free space on folders.  Free space exists on Disks.  I don't know the powershell, way since I've always just used the command line.

You can use the built in fsutil with psexec
psexec \\Computer fsutil volume diskfree c:

You can also use wmic
wmic /node:"%COMPUTERNAME%" LogicalDisk Where DriveType="3" Get DeviceID,FreeSpace

If you have multiple disks, you can use find to isolate the disk.
wmic /node:"%COMPUTERNAME%" LogicalDisk Where DriveType="3" Get DeviceID,FreeSpace|find /I "c:"
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This tutorial will walk an individual through the process of installing the necessary services and then configuring a Windows Server 2012 system as an iSCSI target. To install the necessary roles, go to Server Manager, and select Add Roles and Featu…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now