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
32 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 28

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

A brief introduction to what I consider to be the best editor for PowerShell.
There's a better way to communicate time sensitive or critical info.
This video teaches viewers how to encrypt an external drive that requires a password to read and edit the drive. All tasks are done in Disk Utility. Plug in the external drive you wish to encrypt: Make sure all previous data on the drive has been …
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…

773 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