I have a folder on my E drive named XLK_WorkSheets2023.
Prior to moving files from F:\Finances\CSOB\XLK_WorkSheets2023 to E:\XLK_WorkSheets2023 I need to have the *.xlk files deleted.
Then I need to move (actually move and not leave) the *.xlk files from F:\Finances\CSOB\XLK_WorkSheets2023 to E:\XLK_WorkSheets2023.
I have tried many different iterations of move and if exist then delete and nothing seems to work.
Before this is done I run a batch file that does the following and it works quite well, actually moving the *.xlk files from the indicated folders to F:\Finances\CSOB\XLK_WorkSheets2023.
Here then is the batch file that actually works quite well:
@echo off
move F:\Finances\CSOB\2023\*.xlk F:\Finances\CSOB\XLK_WorkSheets2023
move F:\Finances\CSOB\*.xlk F:\Finances\CSOB\XLK_WorkSheets2023
move F:\Dwight\Memoirs\Docs\dodge\Root\Docs\2023\*.xlk F:\Finances\CSOB\XLK_WorkSheets2023
move "F:\Dwight\In The Event Of My Death\*.xlk" "F:\Finances\CSOB\XLK_WorkSheets2023"
move F:\Finances\CSOB\NewCalendars\*.xlk F:\Finances\CSOB\XLK_WorkSheets2023
move F:\Data\Documents\Cooking\*.xlk F:\Finances\CSOB\XLK_WorkSheets2023
move F:\Dwight\Memoirs\Docs\dodge\Root\Excel\*.xlk F:\Finances\CSOB\XLK_WorkSheets2023
Any help writing a batch file that does what I need would be much appreciated.
And if it is possible that all this can be done with one batch file that would be impressive.
If Exist then Delete
Moderator: DosItHelp
Re: If Exist then Delete
Add
if you want to delete files first.
Saso
Code: Select all
del /f /q F:\Finances\CSOB\XLK_WorkSheets2023\*.xlk
Saso