creating a file with a list


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers creating a file with a list
# 1  
Old 02-05-2007
creating a file with a list

I would like to create a text file that contains the list (names of files and dirs) of a particular directory...

any ideas ?
# 2  
Old 02-05-2007
Use find command

find ./ *.* > alldirnfiles.txt
# 3  
Old 02-05-2007
ls -ltrR > filename.txt # Just sorted on date.
# 4  
Old 02-06-2007
Quote:
Originally Posted by crabbie_upk
find ./ *.* > alldirnfiles.txt
A perfect example of how not to use the find command, this could be a CPU killer.

In case there are several 1000s of files and subdirectories in the directory "./" with a . (dot) in their name, the find will be executed will those files and subdirectories as argument.

This because the *'s are interpreted (expanded) by the shell prior to executing the find command.
# 5  
Old 02-06-2007
ls ./ > list.txt

I did it and it worked, but I don't see the difference with the commands you gave me. Smilie
# 6  
Old 02-06-2007
Differences are format output, content, and order. The -R and -a option to ls will list all (-a) files recursively (-R) down the directory tree. The find command does the recursive automatically and also prints the .(dot) files. The find command will provide better output, but the same information may be obtained by the ls command, just broken out by subdirectory.

cd <dir> ; find . -print
cd <dir> ; find . -ls # I use the -ls option to find as much as the -print option
find <dir> -print |sort # if you want to guarantee order
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Creating list

how do i create a list of every process running on my system and place it into a file lets say p1.txt (1 Reply)
Discussion started by: richiestank
1 Replies

2. UNIX for Dummies Questions & Answers

Creating a two column list of date pairs form a single column list

Hi all, looking for some help here. I'm what you'd call a dirty programmer. my shell scripts might be ugly, but they (usually) function... Say I have a single column text file with a list of dates (yyyymmdd) that represent the elevation of a point on that date (I work with land subsidence, so... (2 Replies)
Discussion started by: jbrandt1979
2 Replies

3. UNIX for Dummies Questions & Answers

Creating a column based list from a string list

I have a string containing fields separated by space Example set sr="Fred Ted Joe Peter Paul Jean Chris Tim Tex" and want to display it in a column format, for example to a maximum of a window of 100 characters And hopefully display some thing like Fred Ted Joe ... (3 Replies)
Discussion started by: kristinu
3 Replies

4. UNIX for Dummies Questions & Answers

Creating columns from a list

I have a list below, how can I have things separated nicely in columns mv browseDir.tcsh browseDir.csh mv checkSRDist.tcsh checkSRDist.csh mv create-data-tinv.tcsh create-data-tinv.csh mv createDocs.tcsh createDocs.csh mv createMisfit.tcsh createMisfit.csh mv createModel.tcsh... (4 Replies)
Discussion started by: kristinu
4 Replies

5. UNIX for Dummies Questions & Answers

Creating a list of files in directory?

Hi All, I would like to do a loop on all the files with extension .out in my directory this files should be sorted alphabetically. Then I need to assign to each of them a progressive ID of three digits (maybe in HEX format?). First I tried to list manually the files as ARRAY=( A-001.out ... (5 Replies)
Discussion started by: f_o_555
5 Replies

6. Shell Programming and Scripting

Creating a range out of a broken list

Hi all, I am trying to create a file which has one or more ranges based on a file containing a long list. The problem is that the file which has this list is not continuous and is broken in many places. I will try to illustrate by an example: The List File: 1 2 3 4 5 6 9 10 11 12... (5 Replies)
Discussion started by: run_time_error
5 Replies

7. Shell Programming and Scripting

ls > file - Creating file containing the list of all files present in a directory

Hi All, I need to create a file which contains the list of all the files present in that directory. e.g., ls /export/home/user/*.dat > list_file.dat but what i am getting is: $ ls /export/home/user/*.dat > list_file.dat /export/home/user/*.dat: No such file or directory But I have... (1 Reply)
Discussion started by: pranavagarwal
1 Replies

8. Shell Programming and Scripting

Creating menu list from configuration file

Hi folks, I have the following function ,which generates menu for installation type: select_install_type() { echo echo ======================================== echo Please select the type of installation: echo ======================================== ... (8 Replies)
Discussion started by: nir_s
8 Replies

9. Shell Programming and Scripting

Creating User Accounts from a list in file

I have a file that contains a list of names. I need a loop that creates user accounts to all the names in the list where username = names in file password = username Another question: how can i validate that a particular var is of 6 characters length I need an if statement that will... (8 Replies)
Discussion started by: Laila Saif
8 Replies

10. HP-UX

creating a mailng list for mailx

I'm trying recall how to set up a script to have mailx read a mailing list of people to recieve a message. I had set up the script to have every name inside but the list could grow and/or change. can any one help? I'm using HPUX 11 on a rp7410. (6 Replies)
Discussion started by: rfmurphy_6
6 Replies
Login or Register to Ask a Question