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.




425 posts

Ultimate Geek


#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!
1017 posts

Uber Geek

Trusted
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?




425 posts

Ultimate Geek


  #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


 
 
 
 




425 posts

Ultimate Geek


  #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




News »

Freeview On Demand app launches on Sony Android TVs
Posted 6-Aug-2020 13:35


UFB hits more than one million connections
Posted 6-Aug-2020 09:42


D-Link A/NZ extends COVR Wi-Fi EasyMesh System series with new three-pack
Posted 4-Aug-2020 15:01


New Zealand software Rfider tracks coffee from Colombia all the way to New Zealand businesses
Posted 3-Aug-2020 10:35


Logitech G launches Pro X Wireless gaming headset
Posted 3-Aug-2020 10:21


Sony Alpha 7S III provides supreme imaging performance
Posted 3-Aug-2020 10:11


Sony introduces first CFexpress Type A memory card
Posted 3-Aug-2020 10:05


Marsello acquires Goody consolidating online and in-store marketing position
Posted 30-Jul-2020 16:26


Fonterra first major customer for Microsoft's New Zealand datacentre
Posted 30-Jul-2020 08:07


Everything we learnt at the IBM Cloud Forum 2020
Posted 29-Jul-2020 14:45


Dropbox launches native HelloSign workflow and data residency in Australia
Posted 29-Jul-2020 12:48


Spark launches 5G in Palmerston North
Posted 29-Jul-2020 09:50


Lenovo brings speed and smarter features to new 5G mobile gaming phone
Posted 28-Jul-2020 22:00


Withings raises $60 million to enable bridge between patients and healthcare
Posted 28-Jul-2020 21:51


QNAP integrates Catalyst Cloud Object Storage into Hybrid Backup solution
Posted 28-Jul-2020 21:40



Geekzone Live »

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


Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



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.