dmtelf has asked for the wisdom of the Perl Monks concerning the following question:
I need to traverse a directory (+ subdirs) and weed out all files that are in the directory structure but not in the array of files to keep.
Another way of expressing this would be, how can I do a directory difference, between a directory structure and an array of files.
I've thought of playing around with file::find, building arrays of the files on the disc, and doing an array comparision with the array of files to keep to get an array that holds all files that are on the HD but not in the files to keep array.
Or is there a better way of doing this?
Additionally, I could save the list of extraneous files by saving the extranous files array to disc. I could then loop through this and move all these files to a "trash" directory. At a later date, I could iterate through the trash directory and optionally restore any files in the trash directory to their previous place in the directory tree.
Any ideas?
thanks for your help, wisdom and enlightenment, o Monks.
dmtelf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hard disc pruner
by lhoward (Vicar) on Jul 07, 2000 at 17:23 UTC | |
by mikfire (Deacon) on Jul 08, 2000 at 03:47 UTC |