New to Windows 7, struggling to figure out xcopy command

sonoferu

Senior member
Jun 6, 2010
286
5
81
New to Windows 7. I am not expert at DOS but I do know some, and long ago wrote my own little batch file to use xcopy to copy my most important files to a flash drive. I let XP schedule it. No idea if it is what a smart person would write for a script but it worked.

So I brought it over to the new box, and something is wrong, and I am stumped.


rmdir /s /q H:_saveold
move H:_save H:_saveold
mkdir H:_save
xcopy /S /q /H "C:Users\Fletcher\Documents\_save\" "H:_save\"

I keep the files in a _save directory, with subdirectories. Named with an underscore, it was at the top of the directory structure, which helps. So the idea is to do a sort of double-barrel backup -- I back up the old backup one time. So the script deletes the old backup directory, moves the backup directory to _saveold, then copies the files into a new _save directory.

The problem in Windows 7 is that it doesnt work the same way, I guess

C:>xcopy /S /q /H "C:Users\Fletcher\Documents\_save\" "H:_save\"
Invalid path
0 File(s) copied

I run it in a separate DOS window, same problem.

I took off the quotes [I used to need them because it was "My Documents".

I added *.* at the end

I tried it using My Documents

I tried it by moving the files to a new folder at C:testfolder and tried to copy from that. I tried to copy not to the flash drive but to C:testfolder2

all failed

Then I thought hey, lets see what Windows has for a backup. So I went through all that, which was not all that easy, I had to make a Library for the files, and then it did the backup, but the result was a backup object on the flash drive that I could restore the whole thing from. Not what I want. I want to be able to go in and fetch one file if I want, not restore and overwrite the whole library

Basically, I want to write a copy script, and I cant find how. I have googled for ideas, and no luck yet

Anyone?
 
Last edited:

sonoferu

Senior member
Jun 6, 2010
286
5
81
How does the C drive syntax turn into a smilie in my post? When I saw it posted, there were smilies scattered throughout, at the filepaths. Like this

C:\Users\Fletcher\Documents\_save\

I took out the \ marks so you just see C: and H:
 
Last edited:

Bubbaleone

Golden Member
Nov 20, 2011
1,803
4
76
These are the commands and syntax as they apply to Windows 7: Xcopy. You may find the more powerful Robocopy better suited for use in Windows 7.

(When you're posting, scroll down a bit below the Editor and check "Disable smilies in text", and "C:\" won't look like a smilie face.
 

ninaholic37

Golden Member
Apr 13, 2012
1,883
31
91
Also worth noting - if you look from Windows Explorer, you'll probably see that this directory (Users\Fletcher) has a "lock" icon on it, which means anything you do in there is under the control of Windows! I save all my stuff in these locations:

Code:
C:\Saved\Games
C:\Saved\Music
C:\Saved\Pics
C:\Saved\Text
C:\Saved\Video
C:\Saved\Utils

This way, Windows "access/permissions" can't touch any of my stuff.
 

mechBgon

Super Moderator<br>Elite Member
Oct 31, 1999
30,699
1
0
Try leaving off the last backslash on the line

C:>xcopy /S /q /H C:Users\Fletcher\Documents\_save\

Tangentially, if your version of Win7 happens to be Pro or Ultimate, then you can recover previous versions of files using Shadow Copy. To do this, use Windows Explorer to open the location (not Libraries view), right-click in the window, choose Properties, and go to the Previous Versions tab.

You might also be interested in Microsoft's SyncToy: http://www.microsoft.com/en-us/download/details.aspx?id=15155


This way, Windows "access/permissions" can't touch any of my stuff.

You say "touch," but I'd say "protect." I sure wouldn't want my user profile's files left wide-open for any trivial exploit to ____________ (delete, encrypt and hold hostage, send out to the Internet, etc).
 
Last edited:

sonoferu

Senior member
Jun 6, 2010
286
5
81
ok, thanks to all

I tried it by moving the files to a new folder at C:testfolder and tried to copy from that. I tried to copy not to the flash drive but to C:testfolder2

One of those times that I shake my head and say "I KNOW I did that last time and it failed" but now it works.

It all makes sense now, so I'm all set