R
R
Roman Kuzmenko2017-11-04 21:30:46
Command line
Roman Kuzmenko, 2017-11-04 21:30:46

How to delete the previous file in a directory?

Hello! There is a task to delete the previous file in the folder.
How to determine the last created one is understandable. How about the previous one? Not pre-prev :) And the previous one, there are no regularities in file names.
Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Olgeir, 2017-11-07
@devrvk

@echo off
for /f "skip=1" %%a in ('dir /ad /on /b *.*') do set A=%%a&goto a
:a
echo %A%

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question