The Surly Admin

Father, husband, IT Pro, cancer survivor

Getting Directory Information Fast

By now, you may have noticed I’m always on the lookout for better performing code.  This has turned out to be a good habit now that I’m working at athena health, as the pure scale of things is so much larger than places I’ve been at in the past.  One piece I’ve never been able to speed up, though, is iterating through folders and files.   Nicolas1847, a PowerShell scripter on Spiceworks, has come up with an ingenious method to get simple directory information using Robocopy (of all things), and a colleague at athena health likes to shell out to CMD.exe and use the old DIR command.  But are they faster?  And if so, which one?

Continue reading

Advertisements

August 4, 2014 Posted by | Powershell - Performance | , , , | Leave a comment

Get File Counts and Size for All Extensions

Inspired from this script, I decided to expand on it and have Powershell get all of the extensions and report on everything.  I also decided to pretty up the report using some HTML.  Read on for this quick hit!

Continue reading

November 26, 2012 Posted by | PowerShell | , | 2 Comments

Get File Sizes by Extension

As I’ve mentioned before, I enjoy trolling the scripts at Spiceworks and converting the vbScripts that are interesting over to Powershell in an attempt to see if I can not only shorten them, but improve them.  One interesting example came by last week, the Get File Size for a Specific Extension script.  Here’s what I did with it.

Continue reading

November 10, 2012 Posted by | PowerShell | , , | 3 Comments

Scan a Folder For Changes

Another fun little project popped up at Spiceworks yesterday.  OP (Original Poster) was looking to create a vbScript that would scan a folder for new files.  The Folder was actually part of an FTP site he had setup and he wanted to be notified by email whenever something new was uploaded to it.  Here’s how I went after the script.

Continue reading

September 11, 2012 Posted by | PowerShell | , , , , , | 17 Comments