Re: Inventory of HD contents with date/time and path info
Re: Inventory of HD contents with date/time and path info
- Subject: Re: Inventory of HD contents with date/time and path info
- From: Roger_Jolly <email@hidden>
- Date: Fri, 19 Jul 2002 12:48:25 +0200
Hi Mike,
Here are some ideas. ;-)
I'm just going to give the Unix commands, because wrapping them in do shell
scripts doesn't really improve readability with all that quoting and
escaping. Besides, now I just have to test the Unix commands and don't have
to worry about the Applescript. :)
First generate a list of your current system:
cd / ; find . -print0 | xargs -0 ls -ld | sed 's/^[^ ]*[ 0-9]*[^ ]*[^0-9]*[^
]* //' | sed -n 's:^\([^\.]*\)\./\(.*\):/\2 \1:p' | sort > ~Desktop/List1
To translate: go to the root directory, find all files and folders in that,
give them one at a time to ls so it can produce a list of all the items
(treating directories as if they were files, because you want information on
them.) Next remove everything before the modification date with a sed
command, followed by one that puts the date after the filename, getting rid
of the annoying dot at the beginning of it to produce absolute paths.
Finally sort it. (That's probably not necessary, but better be safe.)
You'll probably want to save this list somewhere, so I redirected the output
(saved) it to the file List1 on the desktop. You should replace this with a
location of your own, probably something in the tmp folder.
If you just are interested in the files and not the folders, you should do
this:
find . -type f -print0 | xargs -0 ls -ld | sed 's/^[^ ]*[ 0-9]*[^
]*[^0-9]*[^ ]* //' | sed -n 's:^\([^\.]*\)\./\(.*\):/\2 \1:p' | sort >
~Desktop/List1
List1 now contains as complete a list of your system as you can get as user.
To do better, you'll probably should do the do shell script with
administrator privileges. (That still leaves some things outside of your
reach, like the content of the cron jobs folder, but it's highly unlikely an
installer will put something in there.)
Now change your system someway.
Run the command again, but give another destination. Something like:
cd / ; find . -print0 | xargs -0 ls -ld | sed 's/^[^ ]*[ 0-9]*[^ ]*[^0-9]*[^
]* //' | sed -n 's:^\([^\.]*\)\./\(.*\):/\2 \1:p' | sort > ~Desktop/List2
Now you've got two sorted files with (practically) everything that's on your
system. Time to compare them. First everything that was on your system, but
has been removed by the installer:
comm -23 ~Desktop/List1 ~Desktop/List2
Finally, the things that were added to your system:
comm -13 ~Desktop/List1 ~Desktop/List2
If you want just the paths, you should pipe the result through sed.
Something like:
comm -13 ~Desktop/List1 ~Desktop/List2 | sed 's/\(.*\) .* .* ..:../\1/'
Hope this helps,
Roger
on 18-07-2002 17:33, Perbix, Michael at email@hidden wrote:
>
I am looking for a way to generate a FULL inventory (including hidden files)
>
of files on my HD with the item, path (in relation to root, in other words NOT
>
including the HD name) and time/date stamp.
>
>
What I want to do is run this script, then make some changes, run the script
>
again and be able to parse the changes into a file that I could then maybe
>
script an archive or something. The resulting file needs to contain all new,
>
changed (modified) and deleted files.
>
>
Anyone have any ideas?
>
>
For all that are curios, I am looking to replicate the Installer Observer
>
program which does not correctly restore files in OS9.
>
>
Thanks for some insight...
>
>
-Mike
>
>
-------------------------------------
>
Michael Perbix
>
Telecommunications Specialist
>
Lower Merion School District
>
(610) 645-1964 - Phone
>
(610) 896-8224 - Fax
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.