Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.



Windows 7: xcopy comes up with 'file not found'

17 Nov 2012   #1

Windows 7 Home Premium 64bit
 
 
xcopy comes up with 'file not found'

I am just trying to get this simple script i wrote to work in a batch file, but when I run the file, in the cmd screen, it comes up with;

File not found- Backup
0 file(s) copied

This is the script I use;

@Echo Off

xcopy /s "c:\Users\Jacob Smith\Desktop\Server\world d:\Users\Jacob Smith\Desktop\Server\World Save"

I think the problem is in the path (Derp) or the commands (Most likely the way i format the path). Please help, I'm just trying to do this so I can auto-backup a server.

btw, I am a command script-newb but I understand the basics, and I learn easy.

My System SpecsSystem Spec
.

17 Nov 2012   #2

Microsoft Community Contributor Award Recipient

Windows 8.1 Pro Preview with Media Center
 
 

Hi Jake, welcome to the Seven Forums.

You have a simple syntax error. As you know, because you have spaces on path name (for instance your user folder Jacob Smith), you need to put the path between quotation marks. As you only have one quotation mark in the beginning of the source path but no end quotation mark, and respectively no quotation mark in the beginning of the target path, only one at the end of it, Windows logically thinks that "c:\Users\Jacob Smith\Desktop\Server\world d:\Users\Jacob Smith\Desktop\Server\World Save" is one (the source) path statement and when it can not find target path it produces an error message.

Change the paths syntax like this:
"c:\Users\Jacob Smith\Desktop\Server\world" "d:\Users\Jacob Smith\Desktop\Server\World Save"
(Blue = Source Path, Red = Target Path, Green = Missing Quotation marks)

Kari
My System SpecsSystem Spec
17 Nov 2012   #3

Windows 7 Home Premium 64bit
 
 

I did that earlier, and i just tested again, but it comes up with;

Invalid Drive Specification
0 File(s) copied

Im guessing theres two problems then, but it first run into the path one. I don't even know I was specifying a drive.

Btw the cmd window closes less than a second after I run the batch, so some parts of the results may be a bit inaccurate, I have gotten them right so far though.
My System SpecsSystem Spec
.


17 Nov 2012   #4

Microsoft Community Contributor Award Recipient

Windows 8.1 Pro Preview with Media Center
 
 

OK.

Your XCOPY statement has two paths, source and target. Both of them seem to be so called full paths i.e. including a drive, followed by mainfolder and subfolders.

Now check that the paths exist. First source: are you copying from C: drive's Users\Jacob Smith\Desktop\Server\world to D: drive's Users\Jacob Smith\Desktop\Server\World Save?

Next, your source path does not tell what to copy. Wildcard *.* copies all files on source folder but no subfolders and files on those, parameter /s copies also subfolders and files on those (except empty subfolders), and parameter /e also the empty subfolders.

Examples using your source and target paths:
- copy all files from source folder but no subfolders nor files on subfolders:
XCOPY "C:\Users\Jacob Smith\Desktop\Server\World\*.*" "D:\Users\Jacob Smith\Desktop\Server\World Save\"

- copy all files from source folder including subfolders but no empty subfolders:
XCOPY "C:\Users\Jacob Smith\Desktop\Server\World\*.*" /s "D:\Users\Jacob Smith\Desktop\Server\World Save\"

- copy all files from source folder including subfolders, also empty subfolders:
XCOPY "C:\Users\Jacob Smith\Desktop\Server\World\*.*" /s /e "D:\Users\Jacob Smith\Desktop\Server\World Save\"

Notice that wildcards have to be within path quotation marks, parameters just after the end quotation mark of source path, followed by a space before the begin quotation mark of target path.

Oh shit I am complicated after a few whiskies...

Kari
My System SpecsSystem Spec
17 Nov 2012   #5

Windows 7 Home Premium 64bit
 
 

I understand most of that.

I did all that but it still got the same error. I looked the error up online and i found that I either need to 'enable administrative shares, or have the batch file run as the admin (Im the only person ever on this laptop) using the /runas command. I have never signed in as admin, I think I had changed the name to Jacob Smith and customed the password. Maybe you can try and tell me how to do the /runas because i tried ways of doing the other thing, complicated, didn't work.

You do get complicated after a few whiskeys. I wonder what you'd do after an entire bottle of pure alchahol. Probably solve string theory, make a time machine that runs off of love, and invent a machine to increase the human brains capacity usage to use the force.
My System SpecsSystem Spec
17 Nov 2012   #6

Windows 7 Home Premium 64bit
 
 

who's complicated now? huh?
My System SpecsSystem Spec
17 Nov 2012   #7

Windows 7 Home Premium 64bit
 
 

figured it out. I had no clue what the C: and D: things were, but they looked familiar. I looked up the phrase "what is a drive in batch file commands" and found that the hard drive is labled as the C: drive and the CD drive is labled D:. the guy I got this stuff from was posting about copying to a CD. I remembered the drive things from tech class, but I thought Batch file ones were different.

Thank you so much for trying to help me, and I now know for later stuff. Plus, I now know about the /e argument and, as it turns out, will help because I do have an empty file in the world file. You are awesome.
My System SpecsSystem Spec
18 Nov 2012   #8

Microsoft Community Contributor Award Recipient

Windows 8.1 Pro Preview with Media Center
 
 

Not knowing about your IT lingo level, let's have a a short "Path 101".

Letters A to Z followed by colon are used by Windows computers to identify disk drives. This system we still have and use exists thanks for early DOS operating systems. Traditionally drive identifiers A: and B: are (were) reserved for floppy drives, C: for first hard drive where you OS is installed and D: for first removable media drive, normally CD and / or DVD drive.

Floppy drives are almost extinct so basically also the identifiers A: and B: are today free for hard drives and removable media drives but to keep the logics of the system if you use default settings when installing Windows it skips A: and B: installing OS on C: instead and gives identifier D: for your first CD/DVD drive, naming additional hard drives and other possible (internal and external) drives starting from E:.

The Backslash "\" is used on DOS / Windows command language to separate folders (earlier Directories) on a path statement. Thus a typical path statement consists a drive identifier followed by a root level (main) folder and possible subfolders, all separated with backslashes. When path statement does not end with so called wildcards or a filename, it points to the last subfolder on path and all content of it. If it ends with a filename or wildcards it points to that/those files that match the criteria.

Examples.
  • By default a Windows 7 user folder is located on C: hard drive, in root level folder Users' subfolder USERNAME, so for instance my user folder could by default be found in C:\Users\Kari. Notice the backslash signs, first one to separate drive C: from the root level folder Users, the second to separate root level folder from its subfolder Kari.
    .
  • I want to copy everything including subfolders but no empty folders on my user folder to an external hard drive X:, creating a subfolder Kari on X: root level folder Backup Files. The syntax is:
    Code:
    xcopy C:\Users\Kari\*.* /s "X:\Backup Files\Kari\"
    Notice I did not put the source path (C:\Users\Kari) within quotation marks. I could have done it, no prob there, but because that path statement does not have any spaces the quotation marks are not needed. Target however has a space so quotation marks are obligatory.
    .
  • I want to copy all photos from My Pictures taken last year to a USB stick currently having the drive identifier P:, to its root level folder Photos 2011. As I know my digital camera names all photos as YEAR-MONTH-DAY-IDNUMBER.png (for instance 2012-NOV-18-PIC0112.png), I can use XCOPY with source and target paths, using wildcards to pick the files to be copied. Syntax:
    Code:
    xcopy "C:\Users\Kari\My Pictures\2011*.png" "P:\Photos 2011\"

Path 102 only if requested .

Kari
My System SpecsSystem Spec
18 Nov 2012   #9

Windows 7 Home Premium 64bit
 
 

Ok, didn't know I'd get a mini-lecture here, but it's nice to know all that more clearly. You do explain things quite well, as long as you're not drunk, lol. I don't think I need any more info on the path stuff, but thanks for all the help.
My System SpecsSystem Spec
18 Nov 2012   #10

Windows 7 Home Premium 64-bit SP1
 
 

Please mark this thread as solved.
Thanks!
My System SpecsSystem Spec
Reply

 xcopy comes up with 'file not found'





Thread Tools



Similar help and support threads for2: xcopy comes up with 'file not found'
Thread Forum
Solved FOUND.000 File folder and what does it mean General Discussion
Want XCOPY, not ROBOCOPY! File creation error Backup and Restore
No OS file found on disk Hardware & Devices
Solved Created a scheduled .bat file to xcopy. How do I? Customization
Batch file & XCopy Network & Sharing
Help with bat file (xcopy) on Win7 General Discussion
File not found, cannot be deleted General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 11:11 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33