Hi! My name is Renato, from Brazil and I'm new in this forum (and 53 y.o., not too new, rs...)
Well... I wrote a routine I called BACKUP.BAT based in the XCOPY command to keep my data in the drive C: safe in the drive D:. To get it easy for me to navigate through the tree structure of foders, I keep all my data folders in the Desktop folder.
So under the Desktop folders theres is folders like Movies, Music, etc. And under theses ones, e.g., The Entertainer, Scary Movie, etc. And under Scary Movie, folders 1, 2, 3 and 4.
Well, then I set this BAT to be executed in the system start through GPEDIT.MSC. It works fine but the folder for backup in drive D is getting too big because when I delete files in C: they remains in D:
So I'd like to write a routine that deletes files in D: that no longer exists in C:
I'm seeing thare is a lot of syncronizations programs through the Internet but I'd like to see if I could understand batch commands and files to do that.
I though something using the (for me) mysterious commands like FOR %%... and IF. But how can I get a text file filled with the files that are in the C: drive? I've tryied DIR /s /e > something.txt but it's filled with lots of unecessary stuff. And, after all, I don't know what to do with a file name text list, at all.
I'm studying the pages in "DosTips" (http://www.dostips.com/) and trying to understand how to do what I want but, as you can see through this message, English is not that easy for me, rs... excuse, please, a not-too-good English.
Can you help me?
Thanks in advance.
The BACKUP.BAT, if it help.
@echo off
set NOW=BEGIN: %date% - %time%
echo %NOW% >> d:\backup\bkplog.txt
echo >> d:\backup\bkplog.txt
echo Saving desktop folders... >> d:\backup\bkplog.txt
xcopy "C:\Documents and Settings\LedaML\Desktop\*.*" "D:\backup" /s /e /v /d /i /y /c /r >> d:\backup\bkplog.txt
echo >> d:\backup\bkplog.txt
echo Saving address book... >> d:\backup\bkplog.txt
xcopy "C:\Documents and Settings\LedaML\Dados de aplicativos\Microsoft\Address Book\*.wab" "D:\backup\Outlook Express" /s /e /v /d /i /y /c /r >> d:\backup\bkplog.txt
echo >> d:\backup\bkplog.txt
echo Saving Outlook Express database... >> d:\backup\bkplog.txt
xcopy "C:\Documents and Settings\LedaML\Dados de aplicativos\Microsoft\My emails\*.*" "D:\backup\Outlook Express" /s /e /v /d /i /y /c /r >> d:\backup\bkplog.txt
echo >> d:\backup\bkplog.txt
set NOW=END...: %date% - %time%
echo %NOW% >> d:\backup\bkplog.txt
echo ---------------------------------------------- >> d:\backup\bkplog.txt
set NOW=
P.S.: Theres is an invisible character after "echo" in "echo >> d:\backup\bkplog.txt" lines.
It's the invisible character got with Alt-255 (numpad) and causes a blank space.
I'd like a batch to syncronize backup.
Moderator: DosItHelp
Re: I'd like a batch to syncronize backup.
You might want to use robocopy as it has a purge and mirror option.
Re: I'd like a batch to syncronize backup.
Thanks, Squashman!
/MIR or /E /PURGE
Solved.
/MIR or /E /PURGE
Solved.