Solved

Backup script from windows to linux server

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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

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

A brief overview to explain gateways, default gateways and static routes OR NO - you CANNOT have two default gateways on the same server, PC or other Windows-based network device. In simple terms a gateway is formed when a computer such as a serv…
Nslookup is a command line driven utility supplied as part of most Windows operating systems that can reveal information related to domain names and the Internet Protocol (IP) addresses associated with them. In simple terms, it is a tool that can …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

863 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

23 Experts available now in Live!

Get 1:1 Help Now