projectja
asked on
newest file name in a directory
Hi,
I am preparing a script with Powershell.
I'd like to get the newest file name in a directory and assign the name to a string variable.
I've just written this one. I have a question:
dir C:\PREPARACION\logs | sort -prop LastWriteTime | select -last 1
output:
Mode LastWriteTime Length Name
-a--- 9/6/2011 11:38 PM 442200 aswSnx.sys
However, what I want is to assign "aswSnx.sys" file name to a string.
Any advice?
Thanks in advance
I am preparing a script with Powershell.
I'd like to get the newest file name in a directory and assign the name to a string variable.
I've just written this one. I have a question:
dir C:\PREPARACION\logs | sort -prop LastWriteTime | select -last 1
output:
Mode LastWriteTime Length Name
-a--- 9/6/2011 11:38 PM 442200 aswSnx.sys
However, what I want is to assign "aswSnx.sys" file name to a string.
Any advice?
Thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER