title: Batch file for renaming - using if Exist without full path?
body: <p>I am trying to write code to check if certain files have a backup named filename.bkp . If they do,  the code should rename the original file to filename.alt and then rename the backup filename. If no filename.bkp exists i want it to rename filename to filename.bkp and then rename filename.alt to filename. </p>
  
  <p>I am writing this to share with a friend but I don't know his system's file structure. I was trying to write it to work from the batch's current directory as I have done before with renaming scripts. But it doesn't seem to work how I think it should. My script currently does nothing. I'm pretty sure my only problem is not knowing how to call the file without the full path! </p>
  
  <p>Here is my code so far. </p>
  
  <pre><code>@if EXIST "left4dead2\pak01_dir.vpk.bkp" (for /r "left4dead2\" %%i in ("pak01_dir.vpk") do ren "%%~fi" "pak01_dir.vpk.alt" for /r "left4dead2\" %%i in ("pak01_dir.vpk.bkp") do ren "%%~fi" "pak01_dir.vpk") ELSE (for /r "left4dead2\" %%i in ("pak01_dir.vpk") do ren "%%~fi" "pak01_dir.vpk.bkp" for /r "left4dead2\" %%i in ("pak01_dir.vpk.alt") do ren "%%~fi" "pak01_dir.vpk")
  @if EXIST "left4dead2\pak01_dir.vpk.bkp" (echo "Ready for Online Heads Will Roll Match") ELSE (echo "Returned to Default")
  </code></pre>