1.

Solve : Export directory contents?

Answer»

Hi,
I wonder if anyone can help.
I have a very simple batch FILE that takes all .pdf files from a directory (the directory contains LOTS of different file types) and CREATES 'CORR.TXT', which contains just the pdf's:
DIR \\mydir\*.PDF /O:N /B > \\mydir\CORR.TXT
However, CORR.TXT contains the full file name eg. 1.pdf etc. What I need is to drop the .pdf extensions in CORR.TXT as I need to link the .txt file into MS Access.
Is this possible to do during the creation of the .txt file or can this be DONE after it has been created ?

Any help would be appreciated.i would suggest something of the following nature:

1) rename the files in the directory from xxx.pdf to just xxx (i.e. rename sans extensions)
2) run the .bat to copy the file names
3) rename the files again adding the extensions (xxx to xxx.pdf)

this isn't the prettiest or safest way to do it, but it's better than nothing. also, if you're dealing with a large number of files, it could get ugly...

good luck
-darryltry this? :
Code: [Select]for /F %%I in ('dir /B /A-D c:\yourdir\*.pdf') do (echo %%~nI)



Discussion

No Comment Found