So I had a folder with about 100 sub-folders and within these sub-folders were “.cab” files. Every month I would go through each sub-folder manually and move the .cab files to a single folder. And you will agree with me when I say this is time consuming and also a strenuous little exercise.
So I thought it would be much easier if I can automate this task with Powershell. So I came up with this little Powershell script that would search through all my sub-folders and move all the .cab files it could find into a single folder.
—Powershell Script Start—
Loop through folder and sub-folders
Loop through the folder / sub-folders and move all the *.cab files to single directory
No parameters in this script
No example in this script
.Author Anton Potgieter
.Date 20 January 2016
$OldLocation = ‘C:\Temp’
$NewLocation = ‘D:\Temp\Extracted’
$FileType = ‘*.cab’
get-childitem $OldLocation -rec -include $FileType | move-item -destination $NewLocation
—Powershell Script End—
The script saved me more than 2 hours work, which was great, so now I use it to make my life a little easier.
2,651 total views, 1 views today