Sunday, 21 February 2016

Rename All files in Folder at Single time

Step 1:

Select the folder where your files exists.
In my existing files, I want to remove "dbo."

Step 2:
Create one batch file (.bat) in same folder(For my situation .bat file named as "Rename").
hear is the script for .bat file

@echo off
setlocal enabledelayedexpansion
set deletestring=dbo.
echo Ready to start
echo.
pause
echo.
for /f "delims==" %%F in ('dir /b ^| find "%deletestring%"') do (
   set oldfilename=%%F
   set newfilename=!oldfilename:%deletestring%=!
   Ren "!oldfilename!" "!newfilename!"
   )
echo.
echo All done
pause

Step 3:
Now run the .bat file.
Once done, you can able to see the result.



EMP, DEPT Sample script

/****** Object:  Table [dbo].[DEPT]    Script Date: 19-05-2016 06:58:37 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET A...