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!
874 posts

Ultimate Geek
+1 received by user: 49

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 »

Intel introduces new NUC kits and NUC mini PCs
Posted 16-Aug-2018 11:03


The Warehouse leaps into the AI future with Google
Posted 15-Aug-2018 17:56


Targus set sights on enterprise and consumer growth in New Zealand
Posted 13-Aug-2018 13:47


Huawei to distribute nova 3i in New Zealand
Posted 9-Aug-2018 16:23


Home robot Vector to be available in New Zealand stores
Posted 9-Aug-2018 14:47


Panasonic announces new 2018 OLED TV line up
Posted 7-Aug-2018 16:38


Kordia completes first live 4K TV broadcast
Posted 1-Aug-2018 13:00


Schools get safer and smarter internet with Managed Network Upgrade
Posted 30-Jul-2018 20:01


DNC wants a safer .nz in the coming year
Posted 26-Jul-2018 16:08


Auldhouse becomes an AWS Authorised Training Delivery Partner in New Zealand
Posted 26-Jul-2018 15:55


Rakuten Kobo launches Kobo Clara HD entry level reader
Posted 26-Jul-2018 15:44


Kiwi team reaches semi-finals at the Microsoft Imagine Cup
Posted 26-Jul-2018 15:38


KidsCan App to Help Kiwi Children in Need
Posted 26-Jul-2018 15:32


FUJIFILM announces new high-performance lenses
Posted 24-Jul-2018 14:57


New FUJIFILM XF10 introduces square mode for Instagram sharing
Posted 24-Jul-2018 14:44



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.