HELP! I want to locate only dir and tar.gz


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting HELP! I want to locate only dir and tar.gz
# 1  
Old 10-02-2013
HELP! I want to locate only dir and tar.gz

I making a script to restore apache from a configuration_backup tar.

For now i want at the beginning of the script that you can make a choice to choose one of the configuration_backup tars.

I use this code now:
Code:
`locate /restore/configuration/configuration_backup*`

But if i use this i get all the files that are in the backup tars. Like 600 files.

I only want to show this:
Code:
drwxr-xr-x 30 root root 4096 Oct  2 14:19 ./
drwxr-xr-x  3 root root 4096 Sep 25 08:39 ../
drwxr-xr-x  2 root root 4096 Oct  2 14:18 configuration_backup_2013-08-05-15:00:02/
drwxr-xr-x  2 root root 4096 Oct  2 14:18 configuration_backup_2013-08-05-16:00:01/
drwxr-xr-x  2 root root 4096 Oct  2 14:18 configuration_backup_2013-08-06-08:00:01/
drwxr-xr-x  2 root root 4096 Oct  2 14:18 configuration_backup_2013-08-08-11:00:02/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-03-14:00:01/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-03-15:00:02/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-06-11:00:01/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-09-08:00:02/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-17-08:00:01/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-18-13:00:01/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-23-09:11:29/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-23-10:00:02/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-23-12:00:01/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-24-07:00:02/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-24-12:00:01/
drwxr-xr-x  2 root root 4096 Sep 25 12:15 configuration_backup_2013-09-25-07:00:01/
drwxr-xr-x  2 root root 4096 Sep 25 09:04 configuration_backup_2013-09-25-08:00:01/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-25-11:00:02/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-27-09:00:02/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-27-14:00:01/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-28-07:00:01/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-30-13:00:02/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-30-14:00:01/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-09-30-15:00:02/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-10-02-07:00:01/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-10-02-08:00:02/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-10-02-09:00:01/
drwxr-xr-x  2 root root 4096 Oct  2 14:19 configuration_backup_2013-10-02-14:00:02/

Can someone help me to use the right locate option or find option?

Thank you!!

---------- Post updated at 04:03 PM ---------- Previous update was at 03:54 PM ----------

No problem anymore. Own fault of my!
# 2  
Old 10-02-2013
You only want to show the directories? In that case you can use
Code:
find /restore/configuration/ -name configuration_backup* -type d

This User Gave Thanks to Subbeh For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I create a tar file for only dir and its subdir structures??

How do I create a tar file for only dir and its subdir structures?? (4 Replies)
Discussion started by: vx04
4 Replies

2. Shell Programming and Scripting

How to tar this dir excluding some files .au?

Hi all, Thanks for previous help. How to include this in script, I need to tar files which are present in /var/spool/cron/crontabs directory (used for crontab) excluding those files which are having extension .au /var/spool/cron/crontabs>>ls -ltr | grep -v .au total 438 -rw------- 1... (11 Replies)
Discussion started by: manalisharmabe
11 Replies

3. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

4. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

5. UNIX for Dummies Questions & Answers

Tar Exclude Dir with a Specific Words

So here is what I got i have these directories names app-config app-exploded conf gen logs match src target currently i do: tar -cvf file.tar conf gen logs match src target What i want to do is: tar -cvf file.tar (exclude any dir with "app" in it) How can i... (1 Reply)
Discussion started by: rhartleyoh
1 Replies

6. Shell Programming and Scripting

using find to locate hard and soft links with tar

I am digging for certain types of files in the current directory and all its sub-directories and archiving them with the following code: #! /usr/bin/ksh Archive=`date +%Y_%m_%d_%T` find . -type f \( -name \*\.ksh -o -name \*\.sql -o -name \*\.ini \) -print|xargs tar -cf... (4 Replies)
Discussion started by: manthasirisha
4 Replies

7. Shell Programming and Scripting

a script to clone a dir tree, & overwrite the dir struct elsewhere?

hi all, i'm looking for a bash or tcsh script that will clone an empty dir tree 'over' another tree ... specifically, i'd like to: (1) specify a src directory (2) list the directory tree/hiearchy beneath that src dir, w/o files -- just the dirs (3) clone that same, empty dir hierarchy to... (2 Replies)
Discussion started by: OpenMacNews
2 Replies

8. UNIX for Dummies Questions & Answers

tar - Selecting target dir

Hi, 1 - How to select files to tar from a dir (indir) to the tar command? 2 - How to select the target directory where the files in a tar file should go to - I know that by default, tar remembers the path and restores files to that path. I am using HP-UX Thanks. (3 Replies)
Discussion started by: GNMIKE
3 Replies

9. UNIX for Advanced & Expert Users

selective tar image and dir perms

Hi, I'm creating a tar image containing selected files held in a manifest file thus: cat <manifest file> | xargs tar -cvpf tar.out I need to preserve the directory as well as the file perms. When my list contains no separate directory lines, the directory is created implicitly when the... (4 Replies)
Discussion started by: gfarley
4 Replies
Login or Register to Ask a Question