So I got the code to work how I like it for individual files. Based on some of the suggestions below, I was able to come up with this:
$Path = "C:\Users\User\Documents\PowerShell\" $Num = 160 $ZipFile = "FileGroup0000000$Num.zip" $File = "*$Num*.txt" $n = dir -Path $Path$File | Measure if($n.count -gt 0){ Remove-Item $Path$ZipFile Compress-Archive -Path $Path$File -DestinationPath $Path Rename-Item $Path'.zip' $Path'FileGroup0000000'$Num'.zip' Remove-Item $Path$File } else { Write-Output "No Files to Move for FileGroup$File" } The only thing I need to do now is have $Num increment after the program finishes each time. Therefore the program will run, and then move $Num to 160, 161, etc. and I will not have to re initiate the code manually. Thanks for the help so far.
$Number = "$Num"converts your$Numnumeric string into another numerc string. [grin] just use the number, not a string. to get leading zeros, use the string format operator-fand the way that it allows converting numbers to strings ... with leading0characters if you tell it to do so.$Path = "C:\Users\User\Documents\PowerShell\"withpushd "C:\Users\User\Documents\PowerShell\"and remove$Path.