Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $user = read-host "Enter owner's username:"
- $drv = read-host "Enter Optical Drive letter (no colons or slashes):"
- $list = Import-Csv badtypes.csv
- $badlist = @()
- $Extns = @()
- ForEach($xt in $list)
- {
- $Extns += "."_$xt.Extention
- }
- $filepath = $drv +":"
- $cnts = Get-ChildItem $filepath -r
- ForEach($itm in $cnts)
- {
- if($itm.PSis.Container)
- {
- #write new folder name in user's temporary folder
- }
- else
- {
- CheckFile $itm
- }
- }
- Function CheckFile($fl)
- {
- $fildextension = [System.IO.Path]::GetExtention($fl)
- $badfound = 0
- ForEach($a in $Extns)
- {
- if($a -eq $fildextension)
- {
- $badfound = 1
- }
- }
- if(badfound -eq 0)
- {
- write-host "File Type Acceptable:" $fl
- # write file to proper place in the user's temporary folder
- }
- }
- $user = read-host "Enter owner's username:"
- $drv = read-host "Enter Optical Drive letter (no colons or slashes):"
- $list = Import-Csv badtypes.csv
- $Exclusions = "*.$($list.Extension -join ",*.")"
- $DestFolder = New-Item -path "\BAAChomedir$usertransfer$(get-date -f MMddyyyy.HH.mm)" -ItemType Directory
- $FilePath = $drv +":"
- Write-Host "Copying files from $FilePath to $DestFolder`:"
- Copy-Item "$FilePath*" -Destination $DestFolder -Exclude $Exclusions -Recurse -PassThru
- explorer $DestFolder
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement