Solved

Backup script from windows to linux server

Posted on 2006-11-02
2
181 Views
Last Modified: 2010-03-18
Hello,
i'am looking for a script that can permit to do backup.
I am using a windows 2003 file server and a linux redhat 9.
Some files are generated daily on windows and i want to put them on linux server at a specified moment.
After 7 days I want to delete files older than a week on both servers (windows and linux)

Regards!
0
Comment
Question by:brainskill
2 Comments
 
LVL 29

Accepted Solution

by:
mass2612 earned 125 total points
ID: 17863026
Hi,

Are do you have a shared folder configured on the Linux server that can be accessed from the Windows server? If so you can use a simple backup task via the default Windows Backup tool and backup your files to the Linux box and then schedule the backup job as a scheduled task. Here's some code to remove files older than 7 days. As always test these in a test environment first.

*** Windows vbScript ***
      ' WScript.Echo "Processing old backup file cleanup ...... "
      Dim oFSO, sDirectoryPath, oFolder, oFileCollection, oFile, iDaysOld
      'Customize values here to fit your needs
      iDaysOld = 7
      Set oFSO = CreateObject("Scripting.FileSystemObject")
      sDirectoryPath = "e:\backup"           ' can be a UNC path as well \\backupserver\share
      set oFolder = oFSO.GetFolder(sDirectoryPath)
      set oFileCollection = oFolder.Files
      'Walk through each file in this folder collection.
      'If it is older than 3 weeks (7) days, then delete it.
      For each oFile in oFileCollection
            If oFile.DateLastModified < (Date() - iDaysOld) Then
                  oFile.Delete(True)
            End If
      Next
      'Clean up
      Set oFSO = Nothing
      Set oFolder = Nothing
      Set oFileCollection = Nothing
      Set oFile = Nothing
*** End ***

*** Linux script  ***
# This will delete all files found in the backup_dir that have not been modifed in more than 7 days
export backup_dir=/data/backup
find $backup_dir -type f -mtime +7 | xargs rm -f
*** End ***
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article is in response to a question (http://www.experts-exchange.com/Networking/Network_Management/Network_Analysis/Q_28230497.html) here at Experts Exchange. The Original Poster (OP) requires a utility that will accept a list of IP addresses …
Trying to figure out group policy inheritance and which settings apply where can be a chore.  Here's a very simple summary I've written which might help.  Keep in mind, this is just a high-level conceptual overview where I try to avoid getting bogge…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now