Help with copy/rename batch file will PayPal

April 25, 2011 at 19:22:41
Specs: Windows XP
Looking for a little help writing a batch file. I've tried and can't pull it off. A competent programmer can write the program in probably 5 minutes. I'm willing to send $$$ via PayPal for assistance.

Here's a link to my original post: http://www.computing.net/answers/pr...

TIA,
PK


See More: Help with copy/rename batch file will PayPal

Report •

#1
April 25, 2011 at 19:53:59
I'm a little vague on your exact requirements....

I *think* this might be what your after but I'm not sure. It only echo's the result, it doesn't actually do anything at the moment.

@echo off

pushd "t:\he\root\dir"



for /f "delims=" %%a in ('dir /s/b/a-d *.dxf') do (
    for %%b in ("%%~pa\..") do (
        echo copy "%%~fa" "%%~dpb%%~nb\%%~nb-%%~nxa"
    )
)
popd
pause


Report •

#2
April 25, 2011 at 20:23:24
Thanks for the reply. I'll try your program tomorrow morning.

Below is a copy of the script was working on. It is close, but no cigar. I couldn't determine how to go down one additional sub-directory, obtain a lists of the files, and then create a new file that contains the name of the root directory.

@echo off
cls
setlocal enabledelayedexpansion

set level1=D:\General\NexGenInfo\SO_2011\
set level1a=D:\General\NexGenInfo\SO_updates\
if not exist %level1a% md %level1a%

echo.&echo.&echo.
echo Please wait while files are copied...


for /f %%1 in ('dir /ad /b %level1%') do (
set level2=%%1
set /a directs +=1
if not exist !level1a!!level2! md !level1a!!level2!
pushd !level1!!level2!


for /f %%2 in ('dir /b') do (
copy %%2 !level1a!\!level2!\!level2!-%%2
set /a fils +=1
)
popd
)

cls
echo.&echo.&echo.
echo Copying of files is complete.
echo.
echo Sub-Directories = %directs%
echo Files copied = %fils%
echo.
echo Press any key to continue.....
pause
cls

exit/b



Report •
Related Solutions


Ask Question