Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


gumdigger

429 posts

Ultimate Geek
+1 received by user: 3


#26778 2-Oct-2008 23:23
Send private message

hi.

i am trying to write a basic archiving (bash) script. following is the sequence (i final way i thought this might work.)

1. user gets asked what folder to archive
2. using find or someother cmd the script will search that folder name
3. if it finds that the folder is located in 2 or more different locations, the script will ask user which one to archive.
4. make a tar archive and give it the name of the folder.

i am not sure how to do step 2,3,4.

Create new topic
wazzageek
1095 posts

Uber Geek
+1 received by user: 108

ID Verified
Trusted
Lifetime subscriber

  #168718 2-Oct-2008 23:45
Send private message

Ummm - without testing, something like

[code]find $HOME -name "<directory name here>" -type d | wc -l [/code]

this will output the number of directories found ...  use the built in script utilities to switch based upon the output (i.e. 0 = none found, prompt, 1 = do it, 2 = ask)

Of course, this is making a few assumptions / ignoring other things - like staying in the local file system, that the user is capable enough to type in the correct folder name.

Plus, is a tar format what you want?  (other options include cpio / zip)

also - perhaps midnight commander or ytree might be of assistance (I assume this is interactive command line required?)  ([code]apt-get install mc[/code])

rsync might be something that is better to look into?




gumdigger

429 posts

Ultimate Geek
+1 received by user: 3


  #169797 8-Oct-2008 09:57
Send private message

so far i have got
#!/bin/bash

echo "What do you want to backup?"
read path
find $HOME -name "$path" -type d | -l


i am working on how to list the available choices and make user select. sorry i couldnt find much on script utlities. how to use that


gumdigger

429 posts

Ultimate Geek
+1 received by user: 3


  #171566 16-Oct-2008 15:36
Send private message

the archives i make, i want them to name them according to their directory names.
so if i want to backup user1 folder
lilo/disk/storage/user1

then i want to name the archive as user1

Create new topic








Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.