Solved

Backup script from windows to linux server

Posted on 2006-11-02
2
184 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Many of us in IT utilize a combination of roaming profiles and folder redirection to ensure user information carries over from one workstation to another; in my environment, it was to enable virtualization without needing a separate desktop for each…
Resolve DNS query failed errors for Exchange
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

726 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