mercredi 12 février 2020

if\else not working as expected with network location

i have been trying to get this to work but it either does not follow the if/else or it just goes through the the copy and echo and never goes to else if the file does not exists

IF EXIST "\\netowrklocation\folder\*.*" (
    copy "\\netowrklocation\folder\*.*" "\\remotepc\folder" >nul
    echo \\netowrklocation\folder\*.*
    echo copied \\netowrklocation\folder\*.* >>%log%
 ) ELSE ( 
    Echo The file was not found.
    echo try again later
    goto repeat
 )
echo Files Copied
echo Files Copied >>%log%

i'm not sure what i'm doing wrong, but what i want it to do is check if their is a file in \netowrklocation\folder\, if their is copy it and do the echo/log

if not echo file not found, and go to the repeat area (not shown, not relevant)

Aucun commentaire:

Enregistrer un commentaire