Here's the latest code snippet :
Code:
for (){
if (Test-Path C:\Users\user\Desktop\airlab\upload\*.wav){
Write-Output "File recieved"
Start-MpScan -AsJob -ScanPath C:\Users\user\Deskop\airlab\upload
Start-Sleep -Seconds 2
Get-ChildItem C:\Users\user\Desktop\airlab\upload | Copy-Item -Destination C:\Users\user\Desktop\airlab\tmp
Get-ChildItem C:\Users\user\Desktop\airlab\tmp | Rename-Item -NewName tmp.wav
Start-Process 'C:\Users\user\Desktop\airlab\airlab.exe'
Get-ChildItem C:\Users\user\Desktop\airlab\upload | Remove-Item
Start-Sleep -Seconds 17
Write-Output "File exported"
Remove-Item 'C:\Users\user\Desktop\airlab\tmp\tmp.wav'
Start-Sleep -Seconds 90
Remove-Item 'C:\Users\user\Desktop\airlab\download\exported.wav'}
elseif (Get-ChildItem C:\Users\user\Desktop\airlab\upload -Exclude *.wav) {
Get-ChildItem C:\Users\user\Desktop\airlab\upload -Exclude *.wav | Remove-Item
Write-Output "Wrong file type"}
else {
Write-Output "Standby"}
}
Basically now it checks whether the file is a .wav or not and deletes it if it isn't, otherwise it runs the main loop.
Bookmarks