Well, right now what I have written up does the following:
Inputs - $source and $destination directories
From the $source, it grabs the names of the ‘root’ directories, usually about 7 or 8 directories, and then duplicates those under the destination directory. That way some of the files (these are engineering project folders/directories) are sorted a bit. I also make a ‘media’ folder and a ‘simulations’ folder under each of those folders so that images, videos are sorted automatically, and any simulation files are also as I’m gonna do that anyways.
So then the script starts looping through each one of the subdirs and copies all the files out from those, and puts the files into the corresponding destinations.
\project directory\folder 1\bunch of subfolders etc
gets copied into
\destination folder\folder 1\ -all the files from ‘folder 1’
\destination folder\folder 1\media\ -any photos, videos, etc.
\destination folder\folder 1\simulations\ -any model/simulation files that were in the subdirs
There’s an $exclude array that prevents copying things like email messages, miscellaneous log files, some drawing files and other stuff I just won’t need/use.
If the file extension corresponds to what I put in the arrray for $media or $simfiles then it’ll get sorted into the corresponding folders. I learned about the ‘switch’ command today so in retrospect that might have shortened up the code a bit and made it look cleaner. I still haven’t quite gotten the hang of using a switch in a function tho. I haven’t found any documentation for putting the word [switch] in the ‘param’ field in the function subroutine. So I just put a value into a variable and send it into the function. ‘Switch’ seems like ‘Case If’ to me.
That’s basically it. At the moment the modified (from that link) runs quite well. What I’m running into that’s weird is when I right click on a project folder, the number of files it lists is different than the number of files that PowerShell recursively counts. There aren’t any hidden files to my knowledge so I’m not sure what the difference is and why. But I went through one of the folders and manually counted and what powershell tabulates is correct. Don’t know what the extra files are. I did not count folders, heh, just files.
I’m not a very experienced or good programmer but I’ve messed with VBA and VBS quite a bit over the years. Powershell has been really easy to pick up, as opposed to VBS which was quite cryptic to me.
Anywho… you said you were here by choice so… you got the boring brain dump.