locked
Script to copy new files to another folder and then delete original file RRS feed

  • Question

  • Hello, I am looking for a script that will copy only new files from one folder to another. Also, I would like the original file to automatically be deleted. Thank you in advance!
    • Edited by B00GS Wednesday, April 18, 2018 6:06 PM
    Wednesday, April 18, 2018 6:05 PM

Answers

  • It's called 'move', this will copy to new location and then delete from source

    Get-ChildItem <location> | where {
      $_.CreationTime -eq (Get-Date -f "MM/dd/yyyy")
    } | Move-Item <destination>


    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''


    • Edited by clayman2 Wednesday, April 18, 2018 6:12 PM typo
    • Marked as answer by B00GS Wednesday, April 18, 2018 7:06 PM
    Wednesday, April 18, 2018 6:11 PM

All replies