Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 450
  • Last Modified:

Why does the attached code not find the folder?

I am trying to write a simple batch file to copy a folder on the C:\    drive
onto the F:\backup  drive.

When I run the attached code I get a message in the cmd prompt that the file can not be found.
I am 100% sure that this is the correct path.  What is wrong with my code?  Thanks
@echo off
:: variables
set drive=F:\backup
set backupcmd=xcopy /s /c /d /e /h /i /r /y

echo ### Backing up eDIGSNEW
%backupcmd% “C:\eDIGSNEW” "%drive%\eDIGS"



echo Backup Complete!
@pause

Open in new window

0
PDSWSS
Asked:
PDSWSS
  • 5
  • 3
  • 2
1 Solution
 
OP_ZaharinCommented:
set drive=F:\backup
"%drive%\eDIGS"

based on the code above, i would like to double confirmed that you have F:\backup\eDIGS folder created?
0
 
ssisworoCommented:
screen
if error like this, make sure the "C:\eDIGSNEW" already exists.
 screen
0
 
OP_ZaharinCommented:
just double check that all the folder is there. and run the dos prompt as Administrator (right click on Command Prompt shortcuts and select Run As Administrator). kindly also confirmed you have access rights to F drive (if its a map drive).

@echo off
:: variables
set backupcmd=xcopy /s /c /d /e /h /i /r /y

echo ### Backing up eDIGSNEW
%backupcmd% “C:\eDIGSNEW” "F:\backup\eDIGS"

echo Backup Complete!
@pause
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
PDSWSSAuthor Commented:
I am running as an administrator Remote Desktop from a  cmd file and I get the error posted by ssisworo for both my code and your code as if the folder  "eDIGSNEW"  does not exist.  
0
 
PDSWSSAuthor Commented:
I also get a strange character in the cmd window after the file name. Please see attached.
Could this be due to a corrupted file?
Picture-9.png
0
 
OP_ZaharinCommented:
if u do a copy paste of my codes, kindly delete the doublequotes (") on the %backupcmd% "C:\eDIGSNEW" "F:\backup\eDIGS" lines and re-keyin the doublequotes manually...
0
 
ssisworoCommented:
1. make sure “C:\eDIGSNEW” flanked by quotation marks
2. try using another name. for example "C:\TEST"
0
 
OP_ZaharinCommented:
you can see the odd/different doublequotes for both c:\eDGISNEW and f:\backup\eDIGS in your codes “C:\eDIGSNEW” "%drive%\eDIGS"

so delete the doublequotes and manually type it in notepad/edit command in dos prompt. do not use wordpad/ms words.
0
 
PDSWSSAuthor Commented:
Thanks for ending my headache.
0
 
OP_ZaharinCommented:
glad i'm able to help :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now