Delete all files and folders and sub_folders expect some two folders
Posted: 17 Jan 2018 05:11
Say for Example my folder Structure looks like the below one
full_delete=E:\Oracle\Middleware\user_projects\domains\Skandia\servers\AdminService\
expection_folder=E:\Oracle\Middleware\user_projects\domains\Skandia\servers\Extranet-server\
I've to delete all the filea subfolders and folders that are available in the %full_delete%
I used the code
Now I want to do the same thing for %expection_folder% but in this I have to give exception for stage and security sub-folders and the files and folders contents that available under those stage and security folders
full_delete=E:\Oracle\Middleware\user_projects\domains\Skandia\servers\AdminService\
expection_folder=E:\Oracle\Middleware\user_projects\domains\Skandia\servers\Extranet-server\
I've to delete all the filea subfolders and folders that are available in the %full_delete%
I used the code
Code: Select all
pushd "%pathtofolder%" && (rd /s /q "%pathtofolder%" 2>nul & popd)