Finding newest file in all subdirectories

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
rodrigolima
Posts: 21
Joined: 19 Jul 2013 11:35
Location: Brazil

Re: Finding newest file in all subdirectories

#31 Post by rodrigolima » 25 Jul 2013 05:24

Hello foxidrive

I applied the parser to convert date format ddmmyyyy to yyyymmdd and it worked.

The sort command worked perfectlly.

See you

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Finding newest file in all subdirectories

#32 Post by foxidrive » 25 Jul 2013 05:36

Glad to be of help. Cheers.

DataGuy
Posts: 1
Joined: 13 Jan 2018 23:33

Re: Finding newest file in all subdirectories

#33 Post by DataGuy » 13 Jan 2018 23:44

Please explain this portion of the last line of code: set "%1=%rtn:~18%"

I want to modify the block of code in the above post to only bring back the newest date and not worry about the filename.

I am in process of simplifying the for loop to only utilize the date parameters A, B, C and not worry about the time or the path/filename.

For completeness of understanding, I'd like to know what the above code specifically accomplishes (set "%1=%rtn:~18%").

Thank you.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Finding newest file in all subdirectories

#34 Post by aGerman » 14 Jan 2018 07:04

%1 is the first parameter passed to the batch file when it was called. Execute CALL /? to learn more.
%rtn:~18% is the substring of the value in %rtn% beginning after the 18th character till the end. Execute SET /? to learn more.

Steffen

Post Reply