Batch Script : Find Files with Timestamp in Folder
Closed
soumyajit9
Posts
4
Registration date
Tuesday April 17, 2018
Status
Member
Last seen
April 18, 2018
-
Updated on Apr 17, 2018 at 04:58 PM
soumyajit9 Posts 4 Registration date Tuesday April 17, 2018 Status Member Last seen April 18, 2018 - Apr 18, 2018 at 06:45 PM
soumyajit9 Posts 4 Registration date Tuesday April 17, 2018 Status Member Last seen April 18, 2018 - Apr 18, 2018 at 06:45 PM
Related:
- Batch get timestamp
- Whatsapp timestamp wrong - Guide
- Ping batch file output to text - Guide
- Batch rotate images - Guide
- 'Ipconfig' is not recognized as an internal or external command, operable program or batch file. - Guide
- Prevent batch file from closing - Guide
Apr 17, 2018 at 06:19 PM
However, I want to be able to only pull out one file with the current date stamp as of the machine and output it to a log file. The script should be able to find the system date and use the params to find a file with the datestamp.
I am currently using below script:
@echo off
dir %1 /b /o:gn > "%temp%\Listing"
start /w notepad "%temp%\Listing"
del "%temp%\Listing"
exit
How do I only extract the file which has the current date stamp as on the machine ? This is where I am stuck at. How do I define variables for this ?
Apr 18, 2018 at 04:19 PM
If Log.log already exist, it will over write it. If you wish to append to the log.log use the ">" instead of the ">>".
Apr 18, 2018 at 04:52 PM
For example, from that folder, I wish to only extract and write to log, the file which has date stamp - TESTFILE20180418.dat ?
Apr 18, 2018 at 06:13 PM
Cut and paste the code below, then see what it produces. Modify your code based on the result.
Give that a try!
Have fun!