LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 09-25-2004, 06:33 PM   #1
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Rep: Reputation: 30
Slackware's FILELIST.TXT


Anyone know how to output a file list "exactly" like the ones included with Slackware from a shell? Or even how Patrick does it? I've been playing with this for hours and best I can come up with is something like this:

Code:
find . -exec ls -dl --full-time {} \; | cut -f 1,2,3,4,5,7,10 -d ' '
That's pretty close, but if I add the size then it screws up the formating of the columns, ie they don't line up.
 
Old 09-25-2004, 09:53 PM   #2
d0odman
Member
 
Registered: Sep 2004
Location: CA, USA
Distribution: Slackware 10.2
Posts: 132

Rep: Reputation: 15
ls

Code:
ls -l
 
Old 09-26-2004, 12:27 AM   #3
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Original Poster
Rep: Reputation: 30
Re: ls

Quote:
Originally posted by d0odman
Code:
ls -l

Not quiet, thanks though. I'm looking for an output like this:
Code:
drwxr-xr-x  31 root root     1120 2004-09-23 18:12 ./extra
drwxr-xr-x   7 root root      512 2003-02-27 17:54 ./extra/3dfx-glide
-rw-r--r--   1 root root     2514 2001-06-17 22:57 ./extra/3dfx-glide/README
-rw-r--r--   1 root root      932 2001-01-25 19:20 ./extra/3dfx-glide/README.cards
-rw-r--r--   1 root root  2097404 2001-01-25 19:04 ./extra/3dfx-glide/glide_sdk-2.x-i386-1.tgz
-rw-r--r--   1 root root      189 2001-01-25 19:04 ./extra/3dfx-glide/glide_sdk-2.x-i386-1.tgz.asc
-rw-r--r--   1 root root      382 2001-01-25 19:04 ./extra/3dfx-glide/glide_sdk-2.x-i386-1.txt
-rw-r--r--   1 root root  1800770 2001-01-25 19:18 ./extra/3dfx-glide/glide_sdk-3.x-i386-1.tgz

This is closer, but still not exact. Just missing the time because I haven't figured out how to extract just the time and not the nano second that trails with --full-time option yet. And I changed the size format.
Code:
find . -exec ls -dlh --full-time {} \; | awk '{ printf("%-10s %2-s %-4s %-4s %-5s %-10s %s\n",$1,$2,$3,$4,$5,$6,$9) }'
Code:
drwxr-xr-x 31 root root 4.0K  2004-09-23 ./extra
drwxr-xr-x 7  root root 4.0K  2003-02-27 ./extra/3dfx-glide
drwxr-xr-x 2  root root 4.0K  2003-02-27 ./extra/3dfx-glide/voodoo2
-rw-r--r-- 1  root root 189   2001-01-24 ./extra/3dfx-glide/voodoo2/glide_cvg-2.53-i386-1.tgz.asc
-rw-r--r-- 1  root root 204K  2001-01-24 ./extra/3dfx-glide/voodoo2/glide_cvg-2.53-i386-1.tgz
-rw-r--r-- 1  root root 308   2001-01-24 ./extra/3dfx-glide/voodoo2/glide_cvg-2.53-i386-1.txt

Last edited by DaHammer; 09-26-2004 at 12:30 AM.
 
Old 09-26-2004, 01:13 AM   #4
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Original Poster
Rep: Reputation: 30
Here we go:
Code:
find . -exec ls -dl --full-time {} \; | awk '{ printf("%-10s %2-s %-4s %-4s %-10s %-10s %-5.5s %s\n",$1,$2,$3,$4,$5,$6,$7,$9) }
Just not sorted the same way.
 
Old 09-26-2004, 02:51 AM   #5
DaHammer
Member
 
Registered: Oct 2003
Location: Planet Earth
Distribution: Slackware, LFS
Posts: 561

Original Poster
Rep: Reputation: 30
Finished Product

Posting this here in hopes that someone else may find it useful, or better yet improve upon it and repost.
Code:
#!/bin/sh
#
# USE AT YOUR OWN RISK!!!!!
#
# buildlist.sh
#
# Builds a recursive directory list file like the FILELIST.TXT that ships
# with Slackware Linux.
#
# Usage:
# Run ./buildlist.sh path/to/directory
# or ./buildlist.sh /path/to/directory /path/to/listfile
# listfile being the name of the new file that will be created, of course.

LISTFILE=FILELIST.TXT    # Default listfile
# Uncomment one or the other, but not both
#SIZEOP=h                 # Use human readable sizes vs bytes (ie MB/KB)
SIZEOP=""                # Use bytes for sizes

if test "$1" == ""; then
        echo "Usage: $0 directory listfile(optional)"
        exit
else
        if test ! -d $1; then
                echo "Error: $1 - No such directory..."
                exit
        fi;
fi;

if test "$2" != ""; then
        LISTFILE=$2
fi;

echo "Building \"${LISTFILE}\" from \"$1\""

date > ${LISTFILE}
cat <<- EOF >> ${LISTFILE}

Directory listing of $1

EOF

find ${1} -exec ls -dl${SIZEOP} --full-time {} \; \
        | awk '{ printf("%10s %2s %4s %4s %8s %10s %-5.5s %s\n",$1,$2,$3,$4,$5,$6,$7,$9) }' > templist.txt

sort +7d templist.txt >> ${LISTFILE}
rm templist.txt

echo "Done!"

Last edited by DaHammer; 09-26-2004 at 02:53 AM.
 
Old 09-26-2004, 04:29 AM   #6
kersten78
Member
 
Registered: Nov 2003
Location: Minneapolis, MN
Distribution: Slackware, Debian, Gentoo, openSuSE
Posts: 357

Rep: Reputation: 30
Wow man, cut and paste. Cool.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
wine dc++ shuts down when trying to download or get filelist tudilica Linux - Software 3 04-18-2005 06:54 AM
Slackware's beautiful fonts t2701 Slackware 2 09-04-2004 09:59 PM
Slackware's groups broken? ProtoformX Slackware 6 05-15-2004 03:40 AM
Mouse in Slackware's KDE Manarius Slackware 3 11-06-2003 10:28 PM
I broke slackware's keyboard Tech1 Slackware 6 05-07-2003 06:52 AM


All times are GMT -5. The time now is 06:41 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration