Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

DOS read file

MonicaOM12MonicaOM12 Posts: 2Member
Here is what I want to do:

I have some HTML files with names like
/content folder
diagram113660819130 - PREPAY AUDIT-content.html
diagram126591269210 - CAS MAIN-content.html

I have some image files with names
/images
diagram1136608191.pdf
diagram1265912692.pdf

I want to rename the .pdf files as follows:
ren diagram1136608191.pdf 30 - PREPAY AUDIT.pdf
ren diagram1265912692.pdf 10 - CAS MAIN.pdf

I have code as follows:

@echo off
dir diagram*-content.html /B /O :N >digfiles.txt
FOR /F "tokens=1, 2, 3*" %%i in (digfiles.txt) do (
echo %%i %%j %%k %%l
echo.%i:~0,16%
)

here is my output
diagram113660819130 - PREPAY AUDIT-content.html
diagram113660819130[b]:~0,16[/b]

I am unable to get the first 16 characters of i. Also it is not always that the .pdf is 16 characters it could be 17 too.

Can someone help me accomplish what I am trying to do. Thanks in advance for your help.
Sign In or Register to comment.