A
agent60182204
Using Command Prompt on Vista...
I wanted to do get a listing of all the files on my drive so that I
could save it to a text file, and do the same again later and
compare. I used the following command:
DIR /s c:\ > list.txt
But I realized there are some issues:
1) It omits hidden and system files.
2) It might omit files belonging to other users.
To tackle #1, I looked at the syntax of DIR. I can use [DIR /ah] to
list hidden files, but then it lists ONLY hidden files. [DIR /ah /
as] lists hidden files and system files, but no others. There seems
to be no "all" type.
It offers a "minus" syntax too, so [DIR /a-h] lists all non-hidden
files. I can get pretty good results by excluding something rare,
like junction points ("L"), using [DIR /a-L] . Is there a better
way? (I know set-theorists are thinking "Use a Union", but it's not
easy because of the formatting...)
For #2, I say "might" because I seem to get inconsistent results on
Vista. If I DIR the whole drive, while logged in as a non-admin user,
I expected that it would not list files belonging to another user.
But it did, sometimes. Even when [DIR c:\users\bob\documents] fails
(presumably because of permissions), [DIR /s c:\] ends up listing
that documents folder!
But when I ran the same DIR from a different non-admin user, it
omitted the listing of that user's files! Why? Also, one user listed
the Admin's files, and the other didn't! And doing the DIR while
logged in as admin DIDN'T list all users' files!
One possible explanation: On Vista, when I'm logged in as admin, and
using Windows Explorer, if I navigate to another user's documents
folder, it asks me (once only, I think) whether I want to get
permission. If I say yes, it takes about 1 minute to process, and
then gives me access. I guess it changes the permissions on all
files. Does this explain why DIR would omit some items? Is it just
that I never navigated there in Explorer?
I wouldn't mind getting this straight: On Vista, is a non-admin user
allowed to see any other user's files (by exploring c:\users)? Does
it matter if the other user is admin or not? I think the answer for
me has been sometimes yes, sometimes no.
If someone could help clarify these issues, I would appreciate it.
(It's possible that some of my observations above are incorrect. I
tried so many things that I may have mistaken something.)
Still, maybe DIR just isn't the right tool to use. I hope I can use
it, because it's built-in, and works well for my purposes otherwise.
Is ATTRIB any better? Is there some 3rd-party tool I can use?
Thanks
It's off-topic, but if you want to know why I'm saving this DIR, it's
because I noticed that when Norton did a full system scan, it scanned
200,000 files, then a month later it was 400,000, and another month
later it was 800,000. I realize that the number of files it scans can
be more than the number of files on the drive, because it scans files
within compressed files, while it can be less because it only scans
"executable" files. Also, if it chooses to scan files 4 times, it's
none of my business.
I guess Norton didn't actually say that the
number of files on my drive increased that much. The DIR, although it
was flawed, seems to say that I have about 200,000 files. Anyway.
I wanted to do get a listing of all the files on my drive so that I
could save it to a text file, and do the same again later and
compare. I used the following command:
DIR /s c:\ > list.txt
But I realized there are some issues:
1) It omits hidden and system files.
2) It might omit files belonging to other users.
To tackle #1, I looked at the syntax of DIR. I can use [DIR /ah] to
list hidden files, but then it lists ONLY hidden files. [DIR /ah /
as] lists hidden files and system files, but no others. There seems
to be no "all" type.
It offers a "minus" syntax too, so [DIR /a-h] lists all non-hidden
files. I can get pretty good results by excluding something rare,
like junction points ("L"), using [DIR /a-L] . Is there a better
way? (I know set-theorists are thinking "Use a Union", but it's not
easy because of the formatting...)
For #2, I say "might" because I seem to get inconsistent results on
Vista. If I DIR the whole drive, while logged in as a non-admin user,
I expected that it would not list files belonging to another user.
But it did, sometimes. Even when [DIR c:\users\bob\documents] fails
(presumably because of permissions), [DIR /s c:\] ends up listing
that documents folder!
But when I ran the same DIR from a different non-admin user, it
omitted the listing of that user's files! Why? Also, one user listed
the Admin's files, and the other didn't! And doing the DIR while
logged in as admin DIDN'T list all users' files!
One possible explanation: On Vista, when I'm logged in as admin, and
using Windows Explorer, if I navigate to another user's documents
folder, it asks me (once only, I think) whether I want to get
permission. If I say yes, it takes about 1 minute to process, and
then gives me access. I guess it changes the permissions on all
files. Does this explain why DIR would omit some items? Is it just
that I never navigated there in Explorer?
I wouldn't mind getting this straight: On Vista, is a non-admin user
allowed to see any other user's files (by exploring c:\users)? Does
it matter if the other user is admin or not? I think the answer for
me has been sometimes yes, sometimes no.
If someone could help clarify these issues, I would appreciate it.
(It's possible that some of my observations above are incorrect. I
tried so many things that I may have mistaken something.)
Still, maybe DIR just isn't the right tool to use. I hope I can use
it, because it's built-in, and works well for my purposes otherwise.
Is ATTRIB any better? Is there some 3rd-party tool I can use?
Thanks
It's off-topic, but if you want to know why I'm saving this DIR, it's
because I noticed that when Norton did a full system scan, it scanned
200,000 files, then a month later it was 400,000, and another month
later it was 800,000. I realize that the number of files it scans can
be more than the number of files on the drive, because it scans files
within compressed files, while it can be less because it only scans
"executable" files. Also, if it chooses to scan files 4 times, it's
none of my business.

number of files on my drive increased that much. The DIR, although it
was flawed, seems to say that I have about 200,000 files. Anyway.