Get-Files | Archive-Files | Remove-Files

by scottbass at 2013-03-05 23:13:23


I’d love to get some feedback on how the attached scripts could be improved and tightened up. I’m having to jump through some hoops in the Archive-Files script due to idiosyncrasies with 7-zip. But, the scripts appear to be working - each works standalone, but accepts pipeline input as well. Both strings (paths) and System.IO objects are supported.

But, I’m sure they could be tightened up.

All feedback most welcome!

by scottbass at 2013-03-12 02:04:37
I’ve attached updated files:

1) Changed "Get-Files" to "Select-Files"
2) Changed "Archive-Files" to "Backup-Files"
3) Changed approach to processing pipeline vs. command line options
4) Removed validation scripts, moved validation to body of program
5) Changed approach to logging, esp. in Backup-Files
6) Re-written as script modules (rename the .txt files to .psm1) (why aren’t .psm1 files allowed to be uploaded, how are they more dangerous than .ps1 files???)
7) I’ve also attached the "wrapper program" where I’m using these modules

Would love feedback on how to improve these files.

by scottbass at 2013-03-12 02:06:09
Here is the wrapper program…