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


#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
1090 posts

Uber Geek

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?


 
 
 

You will find anything you want at MightyApe (affiliate link).
gumdigger

429 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


gumdigger

429 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 and reviews »

HP Unveils Broadest Consumer Portfolio of AI-Enhanced Laptops
Posted 3-Mar-2024 18:09


Samsung Tab S9 FE Review
Posted 3-Mar-2024 18:00


Norton Genie Review
Posted 3-Mar-2024 17:57


Synology Introduces BeeStation
Posted 23-Feb-2024 14:14


New One UI 6.1 Update Brings Galaxy AI to More Galaxy Devices
Posted 23-Feb-2024 10:50


Amazon Echo Hub Available in New Zealand
Posted 23-Feb-2024 10:40


InternetNZ Releases Internet Insights 2023
Posted 20-Feb-2024 10:31


Seagate Adds 24TB IronWolf Pro Hard Drives for Multi-user Commercial and Enterprise RAID Storage Solutions
Posted 19-Feb-2024 16:54


Seagate Skyhawk AI 24TB Elevates Edge Security Capacity and Performance
Posted 9-Feb-2024 17:18


GoPro Releases Quik Desktop App for macOS and Introduces Premium+ Subscription Tier
Posted 9-Feb-2024 17:14


Ring Introduces New Ring Battery Video Doorbell Pro
Posted 9-Feb-2024 16:51


Galaxy AI Transforms the new Galaxy S24 Series
Posted 18-Jan-2024 07:00


D-Link launches AI-Powered Aquila Pro M30 Wi-Fi 6 Mesh Systems
Posted 17-Jan-2024 20:02


Newest LG 4K Lifestyle Projector Doubles as Art Objet
Posted 9-Jan-2024 15:50


More LG Smart TV Owners Set To Enjoy the Latest webOS Upgrade
Posted 9-Jan-2024 15:45









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.