Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Variables for network paths
- $path=\\Server1\jobvite
- $FinalPath=\\Server1\jobvite\dailyfile
- $Processed=\\Server1\jobvite\processed
- $ProcessDate= Get-Date
- $directory = "$path\*.*";
- $wshell = New-Object -ComObject Wscript.Shell -ErrorAction Stop
- $zipFiles = Get-ChildItem -Path $directory -Filter *.zip;
- Function Create-Jobvite-Doc {
- #Extracts the ZIP file from JobVite and copies it to dailyfile folder
- Expand-Archive -LiteralPath $newpath -DestinationPath $FinalPath -Force
- #Moves the jobvite file from the extracted folder and drops it in the main dailyfile folder
- Move-Item -Path \\Server1\jobvite\dailyfile\dashboard-jobvite_new_employees\*.csv -Destination $FinalPath -Force
- #Deletes the extracted folder
- Remove-Item '\\Server1\jobvite\dailyfile\dashboard-jobvite_new_employees'
- #Creates a new filename and stores is NAME variable
- $Name= (Get-Date -F 'MM-dd-yyyy')
- #applies new fileNAME to the file
- rename-item \\Server1\jobvite\dailyfile\jobvite_new_employees.csv -newname ("jobvite-new-employees-" + $NAME + ".csv")
- #Moves the jobvite file from the extracted folder and drops it in the main dailyfile folder
- Move-Item -Path $newpath -Destination $Processed -Force
- #Email confirmation for completed file
- [....]
- # Process each file
- foreach($zip in $zipFiles) {
- $newpath = "$zip";
- #$wshell.Popup($newpath,0,"Hey!",48+4)
- Create-Jobvite-Doc
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement