Help with rsync file restore script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with rsync file restore script
# 1  
Old 12-12-2012
Help with rsync file restore script

Hello Friends,
I am trying to create an rsync file restore script. I will post want I have below and explain the problem I am having.

Code:
#!/bin/bash
#
# Partial Rsync File Restore Script
#
#
clear
echo
# Shell loads into /raid0/data/backup/bin/
cd ..              # I cd to the backup directory here  
cd store/           # Then cd into store/ here, which is where the script should run         
echo "You are here>  `pwd`"       
echo
echo "Please select a directory or file to restore"
echo
select file in `for i in $(ls); do echo ${i%%.*}; done`
  do
   echo; echo "$file"
   break;
  done
if [ -d "$file" ]
 then 
  cd $file; pwd 
else
  echo "Restore $file?"
fi
unset file     

select file in `ls`; do echo "$file"; break; done
if [ -d "$file" ]
 then 
  cd $file 
else 
  echo "Restore $file?"
fi
unset file

select file in `ls`; do echo "$file"; break; done
if [ -d "$file" ]
 then 
  cd $file 
else 
  echo "Restore $file?"
fi
unset file

The problem I am having is with the select and if commands. Can I create some kind of loop to accomplish this without having to recreate the code manually everytime.

Thanks for your help.
# 2  
Old 12-12-2012
Code:
while true
do
   #Select statement
done

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rsync Error: rsync: link_stat failed: No such file or directory (2)

I wish to copy all the files & folder under /web/Transfer_Files/data/ on mymac1 (Linux) to remote server mybank.intra.com (Solaris 10) /tmp/ location I am using Ansible tool synchronize module which triggers the unix rsync command as below:rsync --delay-updates -F --compress --archive --rsh=ssh... (2 Replies)
Discussion started by: mohtashims
2 Replies

2. Shell Programming and Scripting

Help Writing File Restore Script

Hi all, I have been tasked with creating a script that sends a file into a created "recycling" directory and another script that restores a "deleted" file. I have already created the removal script but am stuck on the restoring part. I need to restore the file to its original location by... (0 Replies)
Discussion started by: bashbeginner
0 Replies

3. Shell Programming and Scripting

Delete/Restore Script

Hi there is anyone able to show me two scripts for a delete and a restore command. Delete - move a file to a dustibin directory that i have created. check to see if that file exsits first in the dustbin if so delete the file before moving the new one. Restore - return the file to its... (1 Reply)
Discussion started by: arsenal1994
1 Replies

4. Shell Programming and Scripting

RecycleBin Script Restore

Hi there I am making a recycle bin script in linux that consists of three scripts delete, trash and restore. The problem is with my restore script, it is using a Paths text file to store file locations when it is deleted, so that if the user restores a file out of the trash bin (recyclebin) the... (8 Replies)
Discussion started by: zinn
8 Replies

5. Shell Programming and Scripting

RecycleBin Script Restore

this is complete.. (2 Replies)
Discussion started by: zinn
2 Replies

6. Homework & Coursework Questions

Bash Script Restore help

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Attempting to make a auto restore script i have one made for backing up cron and installed programs just need to... (1 Reply)
Discussion started by: paperghost
1 Replies

7. UNIX for Advanced & Expert Users

imap & rsync - doing backup & restore

Hi ALL... I have an IMAP server & I have setup rsync to copy all mailboxes (MailDir) to a remote backup machine. rsync is working fine and is copying my files. I need some advice on how to restore a particular mailbox when a user makes a request assuming she has has deleted an important... (1 Reply)
Discussion started by: coolatt
1 Replies

8. AIX

mksysb restore - Wrong OS level for restore

Hi all, I am still working on my mksysb restore. My latest issue is during an alt_disk_install from tape I got the following error after all the data had been restored. 0505-143 alt_disk_install: Unable to match mksysb level 5.2.0 with any available boot images. Please correct this... (0 Replies)
Discussion started by: pobman
0 Replies

9. Shell Programming and Scripting

Restore Script

Hope I have posted this in the correct forum. I'm trying to recover some Oracle files from tape to setup an offsite recovery system. These files are nightly backdumps tar to tape. I have recovered rootvg and vg01 from the weekends full backup, now to restore these nightly files I discovered I... (1 Reply)
Discussion started by: Chrisp
1 Replies

10. HP-UX

recover using legato N and perform incr restore using rsync

Recover point in time copy of the data on target site using Legato/dataprotector and then use rsync to sync the delta (changes) over WAN. Does this work, has anyone tried this. Thanks _Malik (0 Replies)
Discussion started by: mmk
0 Replies
Login or Register to Ask a Question