Quantcast
Channel: Tech Support Guy - Windows 7
Viewing all articles
Browse latest Browse all 6058

XCOPY help...

$
0
0
Hi there. I hope this is the correct place for this question.

I need assistance basically getting XCOPY to be quiet. Here is an excerpt of what I am doing:


echo Begin file copy...
if not exist "C:\somefile" (set var1=folder1) else (set var1=folderA)
if /i "%var1%"=="folder1" (
xcopy "C:\%var1%\folder2\folder3\*.*" H:\folder1\folder2\folder3 /C /S /E /Y /Q /I > nul
) else (
xcopy "C:\%var1%\folderB\folder3\*.*" H:\folder1\folder2\folder3 /C /S /E /Y /Q /I > nul
)
echo Files saved!

Now, it works fine. Does exactly what it is intended to do. All but for one thing; If the source "folder3" has no files in it, XCOPY spits this to the console:

Begin file copy...
File not found - *.*
Files saved!

This is in spite of using XCOPY's "/Q" switch and using a NUL redirect (see above). I've been all over the web looking for an answer to this, and found that most questions revolve around XCOPY not finding files that it should be finding.

For my application, the aforementioned source folder will have files in it sometimes, and other times it won't. I only need this to copy files if they exist, if they don't exist, then I couldn't care less. What I don't need, is XCOPY spitting out phantom errors to the console that are going to get endusers all panicky.

Any help would be appreciated.

Viewing all articles
Browse latest Browse all 6058

Trending Articles