Changing Delimiter in Directory List

197 Views Asked by At

I'm a little bit stuck and need some help.

Currently have a process where completed work is stored in a directory as .txt files (the filename describes what the job was eg. Job1_Machine1_Randomly generated number.txt).

What I would like to do is run a dirlist via a batch file to easily extract the days work. I currently do this as:

dir *.* /s | find "%date%" >dirlisttoday.txt

The next part of my process is to upload the list into an Access database for matching and tracking, I use the files date and time stamp as a 'completed date'.

Currently the second process requires a manual manipulation as the Access import from .txt file only allows a single delimiter, (I have spaces between date/times and underscores in the title).

I can't use fixed width imports as Machine1 can vary in length. The directory is also used by other processes which can't be changed, so changing the filename isn't possible either.

I want to automate this process so it can be carried out by Windows Task Scheduler. Is there a line of script which can be added to my batch file to alter the directory list I create dirlisttoday.txt from:

31/08/2017 12:30 Job1_Machine1_Randomly generated number.txt

to:

31/08/2017 12:30   Job1 Machine1 Randomly generated number.txt
0

There are 0 best solutions below