| Author |
Message |
Tommy *nix forums beginner
Joined: 26 Mar 2005
Posts: 9
|
Posted: Tue Aug 02, 2005 11:50 pm Post subject:
how can i make a complete file system
|
|
|
i was told you can make a command find / > file-list
but i want the file properties i.e file size, date modified,
permissions.
thanks |
|
| Back to top |
|
 |
HASM *nix forums addict
Joined: 01 Jul 2005
Posts: 69
|
Posted: Wed Aug 03, 2005 1:20 am Post subject:
Re: how can i make a complete file system
|
|
|
"Tommy" <tom23499@yahoo.com> writes:
| Quote: | i was told you can make a command find / > file-list
but i want the file properties i.e file size, date modified,
permissions.
|
Either of these should work:
find / -exec /bin/ls -l '{}' ';'
find / -print0 | xargs -0 /bin/ls -l
though you may possibly want to add "-xdev" and/or a combination of
"-fstype <type>" not to follow some mount points, and maybe avoid scanning
/proc or /var with something like "-not -regex '/proc/*'".
You will need to be super-user to be able to descend some directories.
There's also some pretty print file systems tree printing programs around.
-- HASM |
|
| Back to top |
|
 |
Nicholas Andrade *nix forums addict
Joined: 23 Feb 2005
Posts: 84
|
Posted: Wed Aug 03, 2005 2:33 am Post subject:
Re: how can i make a complete file system
|
|
|
Tommy wrote:
| Quote: | i was told you can make a command find / > file-list
but i want the file properties i.e file size, date modified,
permissions.
thanks
Alternatively, to what HASM suggested, ls -lR > file-list would work as |
well. Note that the output is a flat file, and if the purpose of this
is to create a file that can be searched, etc. than the program slocate
works much better. |
|
| Back to top |
|
 |
tom23499@yahoo.com *nix forums beginner
Joined: 03 Aug 2005
Posts: 5
|
Posted: Wed Aug 03, 2005 12:11 pm Post subject:
Re: how can i make a complete file system
|
|
|
Tommy wrote:
| Quote: | i was told you can make a command find / > file-list
but i want the file properties i.e file size, date modified,
permissions.
thanks
|
thanks to both replies. i tried out all commands and they were exactly
what I was looking for. the only one that gave me trouble was the
command -> find / -exec /bin/ls -l '{}' ';'
not sure if it was a typo but bash shell gave the error -> find:
missing argument to 'exec'.
thanks again vey much appreciated. |
|
| Back to top |
|
 |
Nicholas Andrade *nix forums addict
Joined: 23 Feb 2005
Posts: 84
|
Posted: Thu Aug 04, 2005 4:22 am Post subject:
Re: how can i make a complete file system
|
|
|
tom23499@yahoo.com wrote:
| Quote: | Tommy wrote:
i was told you can make a command find / > file-list
but i want the file properties i.e file size, date modified,
permissions.
thanks
thanks to both replies. i tried out all commands and they were exactly
what I was looking for. the only one that gave me trouble was the
command -> find / -exec /bin/ls -l '{}' ';'
not sure if it was a typo but bash shell gave the error -> find:
missing argument to 'exec'.
thanks again vey much appreciated.
I'm inclined to say it's syntax error as well (I believe find expected a |
\ at the end. eg. to move all files ending in .txt to /home/txt use:
find . -name "*.txt" -exec mv '{}' /home/txt/ \; |
|
| Back to top |
|
 |
HASM *nix forums addict
Joined: 01 Jul 2005
Posts: 69
|
Posted: Thu Aug 04, 2005 3:07 pm Post subject:
Re: how can i make a complete file system
|
|
|
Nicholas Andrade <SDNick484@nospam.yahoo.com> writes:
| Quote: | command -> find / -exec /bin/ls -l '{}' ';'
I'm inclined to say it's syntax error as well (I believe find expected a \
at the end. eg. to move all files ending in .txt to /home/txt use: find
. -name "*.txt" -exec mv '{}' /home/txt/ \;
|
Not quite, find expects a ; (semi-colon) to terminate an -exec clause.
However, as the semi-colon is also usually the command separator, one needs
to escape it or the shell will not pass it on to find.
Escaping can be done with backslash or single quoting (most cases). All
four command lines below work on my system, with bash or zsh:
find / -exec /bin/ls -l \{\} \;
find / -exec /bin/ls -l '{}' ';'
find / -exec /bin/ls -l '{}' \;
find / -exec /bin/ls -l \{\} ';'
Try it, with /tmp instead of /, or you'll have to kill the command or wait
for it to complete :-)
-- HASM |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|