locked
Using Powershell to find the oldest file and then move it to another directory RRS feed

Answers

  • What does "not working" mean?

    This would work better:

    Get-ChildItem  \\ash-camods1\CamstarInterfaces\Outbound\MaterialConsumption\Export | 
    	Sort-Object CreationTime | 
    	Select-Object -First 1 | 
    	Move-Item -Destination \\ash-camods1\CamstarInterfaces\Outbound\MaterialConsumption\hung


    \_(ツ)_/

    • Marked as answer by gculbert70 Friday, May 12, 2017 12:41 PM
    Friday, May 12, 2017 11:46 AM

All replies

  • What does "not working" mean?

    This would work better:

    Get-ChildItem  \\ash-camods1\CamstarInterfaces\Outbound\MaterialConsumption\Export | 
    	Sort-Object CreationTime | 
    	Select-Object -First 1 | 
    	Move-Item -Destination \\ash-camods1\CamstarInterfaces\Outbound\MaterialConsumption\hung


    \_(ツ)_/

    • Marked as answer by gculbert70 Friday, May 12, 2017 12:41 PM
    Friday, May 12, 2017 11:46 AM
  • It does not throw any errors but it also does not move the file.
    Friday, May 12, 2017 11:50 AM
  • That did the trick. Thanks
    Friday, May 12, 2017 12:42 PM
  • What do you see on the screen?  When asking for technical help you need to be more accurate and complete.

    \_(ツ)_/

    Friday, May 12, 2017 3:41 PM
  • Se above it is resolved I just needed the structure you provided. It did not throw any errors prior to this or I would have provided them.
    Friday, May 12, 2017 4:27 PM