nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

Getting the list of directory names into a file

This is a discussion on Getting the list of directory names into a file within the Shell scripting forums, part of the Development/Scripting category; Hello, I am running debian linux, i want to get the list of folders in a source folder and copy ...


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 06:48 PM
Junior Member
User
 
Join Date: Apr 2008
My distro: Debian
Posts: 2
Rep Power: 0
hiddenrider007 is on a distinguished road
Default Getting the list of directory names into a file

Hello,

I am running debian linux, i want to get the list of folders in a source folder and copy their names into a file.. Can somebody help me in sorting out this.
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-08-2008, 07:30 PM
rockdalinux's Avatar
Contributors
User
 
Join Date: May 2005
Location: Bangalore
My distro: RHEL, HP-UX, Solaris, FreeBSD, Ubuntu
Posts: 557
Rep Power: 6
rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough rockdalinux is a jewel in the rough
Default

Use find command, to print the list of all dirs including subdir
Code:
find . -type d -print
Save the list to a file:
Code:
find . -type d -print > /path/to/file
less /path/to/file
To just scan current dir and no subdirs
Code:
find . -maxdepth 1 -type d -print
__________________
Rocky Jr.
You may have my body & soul, but you will never touch my pride!

If you have knowledge, let others light their candles at it.

Certified to work on HP-UX / Sun Solaris / RedHat
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 09:59 AM
Junior Member
User
 
Join Date: Apr 2008
My distro: Debian
Posts: 2
Rep Power: 0
hiddenrider007 is on a distinguished road
Default

Nice work rockdalinux.. thanks a lot
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
UNIX Display or list number of files in a current directory raj Getting started tutorials 1 12-07-2007 10:55 AM
Alphabetical file name and list logged in user script oronno Shell scripting 5 08-22-2007 12:10 PM
list of IPs used in a subnet raghuram Networking, Firewalls and Security 1 02-21-2007 09:07 AM
Windows server troubleshooting DNS problem - tools names toor Windows Xp/2000/2003 server administration 8 07-16-2006 08:52 PM
error shell script no such file or directory /bin/sh Linux software 1 01-08-2006 08:34 PM


All times are GMT +5.5. The time now is 02:05 AM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36