?
Solved

Backup script from windows to linux server

Posted on 2006-11-02
2
Medium Priority
?
187 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 29

Accepted Solution

by:
mass2612 earned 375 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Enterprise networks where VoIP phones have been deployed frequently use port configurations that allow both a computer and an IP phone to be plugged into the same switch port but use different VLANs. On Cisco equipment I'm referring to the "native V…
An article on effective troubleshooting
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

801 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