Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Pesky music and movies on user home drives

$
0
0

Hi Community,

This morning i decided i would write a PS command to determine which users have music & movies on their home drive

More importantly I've had to address this, as the file server is fast running out of disk and the client is spending.

So i got to about here... 

Get-ChildItem "filepath" -Recurse -Include *.mp3 | Select Directory, Name, @{Name="MB";Expression={$_.Length/1MB}}

This gives me Directory (File Path), Name & Size in MB

I've spent the last 4 hours on getting this to a point where i believe our client could pull the trigger and force their staff to get rid of the the naughty data.

As i went to output the information to a txt file - it spat the dummy on me with the following error...

"The specified path, file name or both are too long. The fully qualified file name must be less than 260 characters, and the directory must be less than 248 characters."

I spent the next two hours trying to find a work-around and im just flat out of ideas.

Is there an expert who could shed some light or advise a work-around

Many Thanks

Rhys

 


Viewing all articles
Browse latest Browse all 6937