Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Script deleting file it should not.

$
0
0

We have a script that runs on one of our servers and it copies files and folders from another server. Once the copy is complete it deletes files off of the server the files and folders are copied from. There is an exclude file setup that contains a list of files and folders the script is supposed to exclude from this process. This has worked for a long time but recently the script has started deleting files that are located in the exclude file. It does not delete any of the excluded folders. 

Here is the script:

@ECHO OFF

SET YYYYMMDD=%DATE:~10,4%%DATE:~4,2%%DATE:~7,2%
SET LOGFILE=D:\inetpub\LogFiles\_XCOPY\xc%YYYYMMDD%.log

echo %date% %time% >> %LOGFILE%
xcopy \\server.domain.local\dol\* D:\inetpub\_ftproot\dol\ /A /D /EXCLUDE:D:\inetpub\scripts\xcopyExclude.txt /E /V /C /Y /Z >> %LOGFILE%

del /S /Q /A:A \\server.domain.local\dol\* >> %LOGFILE%
echo. >> %LOGFILE%

Here are the contents of the exclude file.

\folder\
\.folder\
.file
.file
.file
\folder\

Any guidance would be appreciated.

 

Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>