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:

`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:

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!

You only want to show the directories? In that case you can use

find /restore/configuration/ -name configuration_backup* -type d
1 Like