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.


411 posts

Ultimate Geek
+1 received by user: 2


Topic # 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
Go Hawks!
862 posts

Ultimate Geek
+1 received by user: 46

Trusted
Subscriber

  Reply # 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?




411 posts

Ultimate Geek
+1 received by user: 2


  Reply # 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




411 posts

Ultimate Geek
+1 received by user: 2


  Reply # 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

Twitter »

Follow us to receive Twitter updates when new discussions are posted in our forums:



Follow us to receive Twitter updates when news items and blogs are posted in our frontpage:



Follow us to receive Twitter updates when tech item prices are listed in our price comparison site:





News »

N4L helping TAKA Trust bridge the digital divide for Lower Hutt students
Posted 18-Jun-2018 13:08


Winners Announced for 2018 CIO Awards
Posted 18-Jun-2018 13:03


Logitech Rally sets new standard for USB-connected video conference cameras
Posted 18-Jun-2018 09:27


Russell Stanners steps down as Vodafone NZ CEO
Posted 12-Jun-2018 09:13


Intergen recognised as 2018 Microsoft Country Partner of the Year for New Zealand
Posted 12-Jun-2018 08:00


Finalists Announced For Microsoft NZ Partner Awards
Posted 6-Jun-2018 15:12


Vocus Group and Vodafone announce joint venture to accelerate fibre innovation
Posted 5-Jun-2018 10:52


Kogan.com to launch Kogan Mobile in New Zealand
Posted 4-Jun-2018 14:34


Enable doubles fibre broadband speeds for its most popular wholesale service in Christchurch
Posted 2-Jun-2018 20:07


All or Nothing: New Zealand All Blacks arrives on Amazon Prime Video
Posted 2-Jun-2018 16:21


Innovation Grant, High Tech Awards and new USA office for Kiwi tech company SwipedOn
Posted 1-Jun-2018 20:54


Commerce Commission warns Apple for misleading consumers about their rights
Posted 30-May-2018 13:15


IBM leads Call for Code to use cloud, data, AI, blockchain for natural disaster relief
Posted 25-May-2018 14:12


New FUJIFILM X-T100 aims to do better job than smartphones
Posted 24-May-2018 20:17


Stuff takes 100% ownership of Stuff Fibre
Posted 24-May-2018 19:41



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.

Alternatively, you can receive a daily email with Geekzone updates.