Advertisement
Guest User

Untitled

a guest
May 13th, 2020
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $Desination = "C:\dest\"
  2. $Source     = "C:\move\"
  3. $action     = $false
  4. $AFiles     = gc "filelist.txt"
  5. $files      = Get-ChildItem -Recurse -Filter *.txt -Path $Source -Exclude "filelist.txt"
  6.  
  7. foreach ($file in $files)
  8. {
  9.      write-host "Checking:" $file
  10.  
  11.      if ($AFiles.Contains($file.name))
  12.      {
  13.         write-host $file.FullName "in list"
  14.        
  15.         if ($action)
  16.         {
  17.             move-item -Force -path $file.FullName -Destination $Desination
  18.         }
  19.      }
  20.      else {
  21.         write-host $file.FullName "not in list, will skip."
  22.      }
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement