Thanks for the help. However, when I try to run it, I get a lot of "The File could not be found" errors.
To be honest, I'm not entirely sure what the script does...
@echo off&setlocal enableextensions
set olddir=%userprofile%\desktop\old folder
set newdir=%userprofile%\desktop\new folder
pushd %newdir%
That much I can figure out... set the variables and then move to the newdir.
for /f "tokens=*" %%c in ('cd') do set basepath=%%c
This sets the variable to the current directory.
for /f "tokens=*" %%d in ('dir/b/s/a') do (
set fullpath=%%d
call:chkit "%%fullpath:%basepath%=%%"
)
When I run this on its own (with echo instead of call:chkit), I get the same file listed many many times (probably the number of times that there are files in the current directory). Is it supposed to take the fullpath of each file and remove the basepath?
popd&endlocal&goto :eof
:chkit
pushd %olddir%
if not exist ".%~1" del /f/a/q "%newdir%%~1"
popd&goto :eof
So... return to the previous directory before the pushd. Move to olddir... and that's where I get lost. I'm not entirely familiar with all the modifiers for variable names and such.
Thanks again.