Solved

Why does the attached code not find the folder?

Posted on 2011-03-15
10
435 Views
Last Modified: 2012-05-11
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
Comment
Question by:PDSWSS
  • 5
  • 3
  • 2
10 Comments
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35143891
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
 
LVL 3

Expert Comment

by:ssisworo
ID: 35143903
screen
if error like this, make sure the "C:\eDIGSNEW" already exists.
 screen
0
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35143938
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
 

Author Comment

by:PDSWSS
ID: 35143964
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
 

Author Comment

by:PDSWSS
ID: 35143982
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
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35144032
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
 
LVL 3

Expert Comment

by:ssisworo
ID: 35144046
1. make sure “C:\eDIGSNEW” flanked by quotation marks
2. try using another name. for example "C:\TEST"
0
 
LVL 23

Accepted Solution

by:
OP_Zaharin earned 500 total points
ID: 35144055
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
 

Author Closing Comment

by:PDSWSS
ID: 35144278
Thanks for ending my headache.
0
 
LVL 23

Expert Comment

by:OP_Zaharin
ID: 35144343
glad i'm able to help :)
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Why run Active Fulls in Backups 19 112
USB backup batch file help needed. 9 85
VM or Imaging options for a computer 4 90
Barracuda Bsckup Server 690 6 80
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will walk an individual through the process of configuring basic necessities in order to use the 2010 version of Data Protection Manager. These include storage, agents, and protection jobs. Launch Data Protection Manager from the deskt…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now