![]() |
|
|
#1 |
![]() Join Date: Dec 2006
Location: hollywood, fla.
Posts: 149 (0.06/day)
Thanks: 11
Thanked 4 Times in 4 Posts
|
Having batch file backup problem...help if u can!
Hi there.
Was making a batch file to do backups of my important files and it works fine for just about any folder except for My Documents. It copies my firefox mozilla backups fine to my c: drive. But if i try to copy my documents to D: drive i get invalid syntax, or file not found. I've tried everything, it just won't do it. Here's the script: @echo off cls echo Press Any Key to continue backup! pause xcopy /s /i d:\backups\Mozilla c:\mozillaback copy . c:\Documents and Settings\spear\My Documents d:\Backups\My documents echo Backup has now finnished ! I've spelled the directories exaclty as you see here, no mistakes. It just won't work. I'm kind of new at this, thanks so much anyone. !
|
|
|
|
|
|
#2 |
|
Eligible for custom title
Join Date: Jul 2007
Location: HTX
Posts: 10,078 (4.68/day)
Thanks: 1,359
Thanked 1,159 Times in 1,035 Posts
|
Because My Documents isnt My Documents anymore. You have to point at the specific directory of the account your backing up
__________________
Athlon XP USERS with COD 4 FIX http://www.techsupportforum.com/foru...ls-202011.html http://www.howorks.com/2011/02/24/ho...-memory-limit/ “Sometimes my level of fail is unprecedented.” -TheMailMan78
“This is what the force of a thousand suns looks like.” -3870x2
|
|
|
|
|
|
#3 |
|
Moderato®™
Join Date: Apr 2009
Location: Statesville, NC
Posts: 3,666 (2.44/day)
Thanks: 4,326
Thanked 2,322 Times in 1,153 Posts
|
Try using "%USERPROFILE%\My Documents".
![]() EDIT: Actually that's for XP.. This is for Vista/Win7 "%USERPROFILE%\Documents"
__________________
“As long as I feel the warmth from the sun and breathe precious air…. I must ask questions to feed the Mind!” Battletag: Mindweaver#1523 Last edited by Mindweaver; Nov 15, 2012 at 01:00 AM. |
|
|
|
|
|
#4 |
|
Moderato®™
Join Date: Apr 2009
Location: Statesville, NC
Posts: 3,666 (2.44/day)
Thanks: 4,326
Thanked 2,322 Times in 1,153 Posts
|
Here is one I wrote awhile back and it puts your stuff in a folder with the days date and time, and adds a log file. Enjoy!
![]() Remember to set the path for the following
Code:
@echo off :: variables :: The below varible "drive" needs to have the path where you want to save it. :: The below varible "Stuff2Backup" needs to be what you want to save. set drive=u:\Backup_Dir set tt=%time:~0,2%_%time:~3,2%_Backup set folder=%date:/=-% %tt% set backupcmd=xcopy /s /c /d /e /h /i /r /k /y set Stuff2Backup="%USERPROFILE%\My Documents" color 9F echo ### Mindweaver's Backup Plain %backupcmd% "%Stuff2Backup%\*.*" "%drive%\%folder%\%file%" echo ### Setting Attribute's attrib +r -h %drive%\* /s /d echo This Backup was created on Date (%date%), Time (%time%). >> "%drive%\%folder%\Backuplog.txt" echo Backup Complete! @pause
__________________
“As long as I feel the warmth from the sun and breathe precious air…. I must ask questions to feed the Mind!” Battletag: Mindweaver#1523 Last edited by Mindweaver; Nov 15, 2012 at 11:42 AM. |
|
|
|
|
|
#5 | |
![]() Join Date: Dec 2006
Location: hollywood, fla.
Posts: 149 (0.06/day)
Thanks: 11
Thanked 4 Times in 4 Posts
|
Quote:
Will try the %userprofile% switch......thanks will let u know if it works!
|
|
|
|
|
|
|
#6 | |
![]() Join Date: Dec 2006
Location: hollywood, fla.
Posts: 149 (0.06/day)
Thanks: 11
Thanked 4 Times in 4 Posts
|
Hope your back gets better...jealous about the painkillers ya got! lol.
Thanks so much for the script. didnt need all the colors n fonts, but will look nice....very cool of u...thanks! Quote:
|
|
|
|
|
|
|
#7 |
|
Moderato®™
Join Date: Apr 2009
Location: Statesville, NC
Posts: 3,666 (2.44/day)
Thanks: 4,326
Thanked 2,322 Times in 1,153 Posts
|
No problem. I noticed something I missed last night while on the pain killers.. lol You'll need to put %USERPROFILE%\My Documents in "" like this "%USERPROFILE%\My Documents" and you'll want to remove the \ in front of Documents. I fixed the code above if you want to re-copy that code.
![]() EDIT: The reason you need to put it in "" is because of the space in My Documents. The batch file will break at that point and tell you it can't find the location.
__________________
“As long as I feel the warmth from the sun and breathe precious air…. I must ask questions to feed the Mind!” Battletag: Mindweaver#1523 |
|
|
|
|
|
#8 | |
![]() Join Date: Dec 2006
Location: hollywood, fla.
Posts: 149 (0.06/day)
Thanks: 11
Thanked 4 Times in 4 Posts
|
Quote:
@echo off cls echo Press Any Key to continue backup! pause xcopy /s /i d:\backups\Mozilla c:\mozillaback copy . c:\%USERPROFILE%\My Documents d:\Backups\My Documents echo Backup has now finnished ! says: the syntax of the command is incorrect. it does the first back..(mozilla) fine...then again at my documents..it's f'd up. This is the exact directory...maybe u can edit it for me? c:\documents and settings\spear\my documents. backing up to D:\backups\mozilla if you can script it for me so i won't fuk up again??? thanks mind! |
|
|
|
|
|
|
#9 |
![]() Join Date: Aug 2009
Location: Los Angeles/Orange County CA
Posts: 1,125 (0.82/day)
Thanks: 1,991
Thanked 372 Times in 302 Posts
|
just wondering my first command is xcopy and the next is copy ...
|
|
|
|
|
|
#10 | |
|
Moderato®™
Join Date: Apr 2009
Location: Statesville, NC
Posts: 3,666 (2.44/day)
Thanks: 4,326
Thanked 2,322 Times in 1,153 Posts
|
Quote:
Copy and replace what you have in your batch file with this. Code:
@echo off cls echo Press Any Key to continue backup! pause xcopy /s /i d:\backups\Mozilla c:\mozillaback xcopy /s /c /d /e /h /i /r /k /y "%USERPROFILE%\My Documents" "d:\Backups\My Documents" echo Backup has now finished!
__________________
“As long as I feel the warmth from the sun and breathe precious air…. I must ask questions to feed the Mind!” Battletag: Mindweaver#1523 |
|
|
|
|
|
|
#11 | |
![]() Join Date: Dec 2006
Location: hollywood, fla.
Posts: 149 (0.06/day)
Thanks: 11
Thanked 4 Times in 4 Posts
|
Ahhh, now i understand!
gonna put that new script in...now i know forever if there's any space use Quotes "" . And i'm gonna try it right now...hold on. Quote:
|
|
|
|
|
|
|
#12 |
![]() Join Date: Dec 2006
Location: hollywood, fla.
Posts: 149 (0.06/day)
Thanks: 11
Thanked 4 Times in 4 Posts
|
it worked! thanks!
Now i have to figure out why my documents folder is hidden on the D: drive....lol. i can see it thru cmd prompt....but not in explorer. I just un attribed it -a -h -r -s....still don't see in folder... But thanks again for the code brother .....bless u! lyndon |
|
|
|
|
|
#13 |
|
Hardcore Monkey Moderator
Join Date: Feb 2007
Location: Cheeseland (Wisconsin, USA)
Posts: 12,117 (5.27/day)
Thanks: 591
Thanked 5,493 Times in 2,937 Posts
|
You could use robocopy and save yourself a lot of trouble.
It's one line in a batch file to do just about everything you want and it will only backup files that changed so you aren't running a full backup when you don't need it. I use it to backup my fileservers at work. The newer version (post-XP) will multi-thread the backup too. Just a tip from yer Ol' Uncle Kreij
__________________
Cloud (noun, singular): A dynamic arrangement of multiple potential single points of failure, with a user at one end and their data at the other. Get more tech news on a wide variety of topics at NextPowerUp
|
|
|
|
| The Following User Says Thank You to Kreij For This Useful Post: |
|
|
#14 | ||
|
Moderato®™
Join Date: Apr 2009
Location: Statesville, NC
Posts: 3,666 (2.44/day)
Thanks: 4,326
Thanked 2,322 Times in 1,153 Posts
|
Quote:
![]() Quote:
__________________
“As long as I feel the warmth from the sun and breathe precious air…. I must ask questions to feed the Mind!” Battletag: Mindweaver#1523 Last edited by Mindweaver; Nov 17, 2012 at 12:54 AM. |
||
|
|
|
|
|
#15 |
|
Hardcore Monkey Moderator
Join Date: Feb 2007
Location: Cheeseland (Wisconsin, USA)
Posts: 12,117 (5.27/day)
Thanks: 591
Thanked 5,493 Times in 2,937 Posts
|
Yeah, the granular control over what determines when a file should be backed up (file attributes, tweaks, etc.), the ability to specify directories to not include, ability to write the backup anywhere (Mapped drive, USB drive, etc.) and the ability to write/append logs make it easily as good as a paid backup solution.
Someone wrote a GUI for it, but it was a bit lacking the last time I looked at it. Note : Robocopy is not for the faint of heart. It has more switches and options than TMM has infractions.
__________________
Cloud (noun, singular): A dynamic arrangement of multiple potential single points of failure, with a user at one end and their data at the other. Get more tech news on a wide variety of topics at NextPowerUp
Last edited by Kreij; Nov 19, 2012 at 07:53 PM. |
|
|
|
| The Following User Says Thank You to Kreij For This Useful Post: |
|
|
#16 |
|
Moderato®™
Join Date: Apr 2009
Location: Statesville, NC
Posts: 3,666 (2.44/day)
Thanks: 4,326
Thanked 2,322 Times in 1,153 Posts
|
Hell yea! lol
__________________
“As long as I feel the warmth from the sun and breathe precious air…. I must ask questions to feed the Mind!” Battletag: Mindweaver#1523 |
|
|
|
|
|
#17 | |
![]() Join Date: Dec 2006
Location: hollywood, fla.
Posts: 149 (0.06/day)
Thanks: 11
Thanked 4 Times in 4 Posts
|
i will search for it on a torrent site..
I do like working in dos, but yea, an incremental or differential backup is preferable for sure. Thanks for the tip ...gonna go snatch that muthr now! Quote:
|
|
|
|
|
|
|
#18 |
|
Hardcore Monkey Moderator
Join Date: Feb 2007
Location: Cheeseland (Wisconsin, USA)
Posts: 12,117 (5.27/day)
Thanks: 591
Thanked 5,493 Times in 2,937 Posts
|
Robocopy is free from Microsoft. It comes with everything after XP and is a free download for XP.
__________________
Cloud (noun, singular): A dynamic arrangement of multiple potential single points of failure, with a user at one end and their data at the other. Get more tech news on a wide variety of topics at NextPowerUp
|
|
|
|
|
|
#19 | |
![]() Join Date: Dec 2006
Location: hollywood, fla.
Posts: 149 (0.06/day)
Thanks: 11
Thanked 4 Times in 4 Posts
|
i just did a search...and one guy says this:
RichCopy is a free utility that comes to us from Ken Tamaru of Microsoft. Some people say richcopy is an improvement over robocopy. Guess i'll try both! u ever hear of richcopy? Quote:
|
|
|
|
|
|
|
#20 |
|
Hardcore Monkey Moderator
Join Date: Feb 2007
Location: Cheeseland (Wisconsin, USA)
Posts: 12,117 (5.27/day)
Thanks: 591
Thanked 5,493 Times in 2,937 Posts
|
No, that is new to me. Researching now. Thanks for the info.
update : looks like Richcopy has a GUI but has some issues and is not supported by MS (like robocopy). Not that you need support by MS, but I wonder how well problems/issues are dealt with if found.
__________________
Cloud (noun, singular): A dynamic arrangement of multiple potential single points of failure, with a user at one end and their data at the other. Get more tech news on a wide variety of topics at NextPowerUp
Last edited by Kreij; Nov 17, 2012 at 08:42 PM. |
|
|
|
|
|
#21 |
|
Semi-Retired Folder
Join Date: Nov 2005
Location: Indiana
Posts: 17,754 (6.48/day)
Thanks: 780
Thanked 5,116 Times in 3,707 Posts
|
They aren't, there hasn't been an update to richcopy in years, and it isn't perfect.
I used to use robocopy backup scripts for my backups, but I'm too old/lazy to write scripts for every backup so I just use FBackup now. Plus I like that FBackup will use the volume shadow copy, so files in use still get backed up, which robocopy won't do. |
|
|
|
|
|
#22 |
![]() Join Date: Dec 2006
Location: hollywood, fla.
Posts: 149 (0.06/day)
Thanks: 11
Thanked 4 Times in 4 Posts
|
i uninstalled it...looks like i can only backup 1 dir. at a time.....F*k that!
lol. The other one robocopy is crazy....alot of dos commands, ( i like dos) but it also installed some files i didn't liike... some extra processes that i hate using my meager 4 gb i have. Maybe i'll go back to backupmagic. that will backup differential, incremental...and multiple dir's. I was just wondering why my batchfile i tried didn't work...but i understand how it works...need quotes if there's a space in directory name. so what'd u find out? about richcopy? |
|
|
|
|
|
#23 | |
![]() Join Date: Dec 2006
Location: hollywood, fla.
Posts: 149 (0.06/day)
Thanks: 11
Thanked 4 Times in 4 Posts
|
cool....i will try that one out!
is it free? Quote:
|
|
|
|
|
|
|
#24 |
|
Semi-Retired Folder
Join Date: Nov 2005
Location: Indiana
Posts: 17,754 (6.48/day)
Thanks: 780
Thanked 5,116 Times in 3,707 Posts
|
Yes, it is free.
__________________
Rig1: System Specs. Rig2: A8-5600K@4.4GHz / AsRock FM2A75 Pro4 / 8GB Corsair DDR3-1600 9-9-9-24 / HD7560D / Samsung DVD-Burner / 1.5TB WD Green + 3x3TB WD RED in RAID5 Rig3: Athlon X2 4200+ / M4A79 Deluxe / 4GB G.Skill Pi DDR2-800 4-4-4-12 / GT430 / Sony DVD-Burner / 500GB WD Rig4: Phenom II x6 1605T @ 3.6GHz / Asus M5A99X Evo / 8GB PNY DDR3-1600 9-9-9 / GTX470 & GTX470 / Samsung DVD-Burner / 1.5TB Seagate |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Batch file programming | boogerlad | Programming & Webmastering | 4 | Mar 4, 2011 06:13 AM |
| Batch file helpies! | <<Onafets>> | Programming & Webmastering | 5 | Nov 22, 2009 05:05 AM |
| need batch file help | Solaris17 | Programming & Webmastering | 14 | May 21, 2008 11:00 AM |
| Batch File Recognition | PVTCaboose1337 | Programming & Webmastering | 6 | Jan 17, 2008 06:36 AM |
| help with simple batch file | djmonson | General Software | 15 | Jun 28, 2007 02:47 AM |