jeffharbert icon

Move oldest file to different folder

jeffharbert | PRO | 02/28/18 02:41:38 PM UTC | 0 ⭐ | 359 👁️ | Never ⏰ | []
PowerShell |

370 B

|

None

|

0 👍

/

0 👎

# Change the -Include file extension to whatever you need.
# This example uses .jpg
# To ignore file extensions, use this syntax on the first line:
# Get-ChildItem -Path c:\path\to\source\folder\* |
 
Get-ChildItem -Path c:\path\to\source\folder\* -Include *.jpg | 
Sort-Object CreationTime | 
Select-Object -First 1 | 
Move-Item -Destination c:\path\to\destination\folder

Comments