Solved BATCH Extract filename without extension

August 7, 2012 at 11:21:54
Specs: Windows XP

I am writing a windows batch script which does the following:
1.Find the latest created zip file on a remote server and copy it to local server.
2.Extract zip file to dmp file.
3.Replace the filename from to filename.dmp and run the import command.

I was able to do the first 2 as follows:

setLocal EnableDelayedExpansion
for /f "tokens=* delims= " %%a in ('dir/b/a-d/o-d W:\*.jar') do (
set latest=%%a & goto :done
echo We Will copy: !latest! >> %LOG_FILENAME%
copy W:\!latest! G:\BatchJobs\DataRefresh\MPADEV\JarDataFile

However I am not able to achieve the 3rd Step.
Any help?

My command will look like this
imp filename.dmp--Where I have

See More: BATCH Extract filename without extension

Report •

August 7, 2012 at 17:07:42
✔ Best Answer
I question the accuracy of your steps.
for /f "delims=" %%a in ('dir/b/a-d/od W:\*.jar') do set latest=%%a& set name=%%~Na
echo We Will copy: %latest% >> %LOG_FILENAME%
copy W:\%latest% G:\BatchJobs\DataRefresh\MPADEV\JarDataFile\%name%.dmp

How To Ask Questions The Smart Way

Report •
Related Solutions

Ask Question