Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

batch file code needed 1

Status
Not open for further replies.

parallon

MIS
Dec 27, 2002
103
US
Hey there all. I am running a batch file that backs up any new files in the "My Documents" folder from each user pc to the server upon logoff, well I have noticed that if the user deletes this file, the files on the server don't update that change. Is there a way to compare the source and destination and delete the file on the server if it is not in the source folder? The only other thing I can think of is to delete the destination folder once a month before the backup, but then I would have to reset all the archive bits. Any help would be appreciated.

Thanks in advance,

Parallon

"I used to think that the more that you knew, the farther you would go, then I realized that the more that you know, the more they use you."

-Me
 
Sure there is a way... instead of using XCOPY or copy in your batch file, use Robocopy.

Robocopy command can synchronize files and folders instead of just re-copying them. This is actually way more effecient. robocopy will not re-copy files unless they are modified. If a file is deleted in the source directory (and mirror) is used, the file will be deleted in the target directory. This enables files to be completly synchronized.

Here is where you can download it:

Joseph L. Poandl
MCSE 2003

If your company is in need of experts to examine technical problems/solutions, please check out (Sales@njcomputernetworks.com)
 
Is there a version for 2K?

Let them hate - so long as they fear... Lucius Accius
 
Thank you very much. I think there is a lot more in this package that I can use also.

Thanks again,

Parallon

"I used to think that the more that you knew, the farther you would go, then I realized that the more that you know, the more they use you."

-Me
 
Jpoandl

Does Robocopy.exe need to be installed on each PC, or is it accessing it from the server's copy?

The reason that I ask is that on one PC, there was an error stating that the command Robocopy.exe was not recognized. But if you point to the batch file on the server, it works fine. We are running the logoff stuff through ScriptLogic.

Parallon

"I used to think that the more that you knew, the farther you would go, then I realized that the more that you know, the more they use you."

-Me
 
Uh, Think of this example:

If I copy a Word document on a computer that has Word installed, the user will be able to open the file without any problems.

If I take the Word document and place it on a computer that does not have the Word application installed, the document will not open.

So, I'm not sure of exactly what your environment is, but you have to make sure that however the robocopy command is being executed, that there is access to the robocopy command.

Many times this can be accomplished by copying the robocopy.exe to the client computer in the logon script before using robocopy to compare and synch files. If you can, just dump robocopy in each computers %systemroot%\System32 directory. This way you will be sure that the client computer understands the command robocopy

-later

Joseph L. Poandl
MCSE 2003

If your company is in need of experts to examine technical problems/solutions, please check out (Sales@njcomputernetworks.com)
 
Just out of curiosity, why don't you have your users work off of the server and enable offline files to have Win2K manage the synchronization?

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
good idea...although IMO thats the best option for people on the go (ie laptops) as it provides two way synch

most people don't need those features and can be lazy about logging off or messing up the synch options..

my solution.

you can effectively map anyones my documents anywhere on their pc or to any network location (i have only tried this with a system that can resolve netbios/DNS names though)

just right click...bring up the properties and select the target you want it to go to (in your case the server)

then you just have to set up some directories for each employee with the proper permissions

and then you have "real time" backups..granted there isn't actually a local copy saved anymore but since you have everything backup up right now you obviously have the space...and hopefully a decently fast network..you can do this with outlook pst files as well just in case you dont have exchange server like my company

 
good points, except the PST one!
Those are a serious drain on a network, and, worse, if a connection fails, it can get corrupted, after all, a PST is a database.

Marc
[sub]If 'something' 'somewhere' gives 'some' error, expect random guesses or no replies at all. Please specify details.
Free Tip: The F1 Key does NOT destroy your PC!
[/sub]

How Do I Get Great Answers To my Tek-Tips Questions? See faq222-2244
 
Microsoft has a free add on for Outlook that will automatically backup a PST when Outlook is closed.

I agre, you should always keep a PST local while the user is using it. The backup tool can then copy ot out to the server for you.

Only real downside is that the larger the file the longer it will take. In my testing however this does appear to actually synchronize and not just to a flat file copy.

You can get the tool that works for several versions of Outlook at:

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
humm...thats some food for thought..

although i have been using that setup for something close to 10 months without a single problem....

and the only slowdowns we have were due to "glitches" in windows (naturally i found the fixes here) and OAS virus protection.

at any rate all of the pst files are backed up to tape daily.

and with about pst files hitting over 2 gigs (were talking people who never clean out attachments for years and we get reams of 1-2 MB pdfs each day) i dont know if backup syching is practical considering we have a 20 person mad dash at 5pm every day
 
I am using this string

Code:
robocopy /e /mir /copy:DAT /log+:c:\test_log.txt /tee "c:\documents and settings\%USERNAME%\Favorites\*.*" "z:\Backups\%USERNAME%\%COMPUTERNAME%\Favorites"

and getting this error message back. can anyone see a problem in this?

ERROR : Invalid Parameter #6 : "c:\documents and settings\jasono.office.*\Favorites"



Thank you,
Jason
 
again, is there a version for 2K... it says right on the page it is for XP and 2003... Does not install on 2K based machines

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top