Re: maintain control over very many files
by clemburg (Curate) on Feb 25, 2002 at 12:06 UTC
|
Hm, sounds like you want a versioning system or something similar ... or just a directory monitor? Below are some links that might be helpful ...
Christian Lemburg
Brainbench MVP for Perl
http://www.brainbench.com
| [reply] [Watch: Dir/Any] |
Use File::Find and stat - Re: maintain control over very many files
by metadoktor (Hermit) on Feb 25, 2002 at 12:18 UTC
|
You can use File::Find to traverse the specific directory that you want to look at and stat each file for the modify time as you process it using File::Find.
As for keeping track of new files you can always save the previous directory contents and compare them to whatever is in there now. If your list of files is truly huge then you may have to employ special tricks to optimize your compares.
metadoktor
"The doktor is in." | [reply] [Watch: Dir/Any] |
|
No, you don't want to go that way. There are tools out there (see above) that can do it all for you. Why reinvent the wheel for the nth time.
Christian Lemburg
Brainbench MVP for Perl
http://www.brainbench.com
| [reply] [Watch: Dir/Any] |
|
_IF_ you want to do such, you will have to remember of each file, what the last modifytime was - where are you going to store this?
The trick is (that is _IF_ you _REALLY_ want this) to touch a .time file (or some other hidden file) when your done with that dir, and then process the next. This way all newer then .time is newer... (if . is <= .time you don't even have to look in that dir...)
Sinister greetings.
"With tying hashes you can do everything God and Larry have forbidden" -- Johan Vromans - YAPC::Europe 2001
perldoc -q $_
| [reply] [Watch: Dir/Any] |
Re: maintain control over very many files
by rinceWind (Monsignor) on Feb 25, 2002 at 11:03 UTC
|
costas, you didn't say what operating system platform
you are running on. This is an important consideration, as there are differences in quota management, access control lists, etc.
I presume it is some varety of Unix as you mention Cron.
In terms of wanting _TOTAL_ control of your files, please can you be more specific as to what you want.
| [reply] [Watch: Dir/Any] |
Re: maintain control over very many files
by Sinister (Friar) on Feb 25, 2002 at 11:01 UTC
|
I guess I can't tell you much if you don't supply a little context.
For instance, do these new files need to be uploaded somewhere else? Then use rsync.
Do you need to just report these files? Use a perl-script.
Sinister greetings.
"With tying hashes you can do everything God and Larry have forbidden" -- Johan Vromans - YAPC::Europe 2001
perldoc -q $_
| [reply] [Watch: Dir/Any] |
Re: maintain control over very many files
by costas (Scribe) on Feb 25, 2002 at 12:03 UTC
|
The directory i am scanning is a local copy of a website. Any files that with recent date modification will then be FTP' to the live site.
I am running the site on IIS. its a total microsoft environment but i have active perl installed on the machine. | [reply] [Watch: Dir/Any] |
|
| [reply] [Watch: Dir/Any] |
Re: maintain control over very many files
by costas (Scribe) on Feb 25, 2002 at 12:06 UTC
|
i mentioned cron since i am used to working in unix. But i will be using the ms equivalent. | [reply] [Watch: Dir/Any] |
Re: maintain control over very many files
by costas (Scribe) on Feb 25, 2002 at 12:11 UTC
|
i essentially want to check file date modification only.
i am also running on iis. | [reply] [Watch: Dir/Any] |
Re: maintain control over very many files
by costas (Scribe) on Feb 26, 2002 at 14:59 UTC
|
I have now expanded on my needs and am looking for the following:
A perl script/prog which can monitor many folders on a local mchine (each folder representing a different site). THe perl script will be executed on a timly basis. If a new or modified file is found, the file will then be FTP'd to its relevant hosting machine.
All platforms are microsoft with IIS.
Can anybody recommend or tell me the best solution. Or is anybody already using a perl based solution such as this already? NOte that multiple site flows must be maintained.
thanks costas | [reply] [Watch: Dir/Any] |