Yes, this is what i found out aswell. So how do i go around this problem? should i try using another tactic?
The script deletes all files first , that alters the -M on the directory, which means i have to delete the directoy first? but i cant do that if there is files in it, unless i am using rmtree from File::Basename i think it was, and i really want to be sure that the files i delete and the directories i delete are all over $age old. Any way to get around this problem? someone must have done this before, searching a directoy recursivly and deleting files and directorys X days old. Is there a way of checking if the directory is empty aswell? would it be this? -s File or directory exists and has nonzero size (the value is the size in bytes) //Dave -----Original Message----- From: Jenda Krynicky [mailto:[EMAIL PROTECTED]] Sent: den 26 september 2002 19:42 To: '[EMAIL PROTECTED]' Subject: Re: File::Find From: "David Samuelsson (PAC)" <[EMAIL PROTECTED]> > i made a small script to clean out logfiles in a dir, actually its a > sub in a bigger script, but i get some toubles. Be carefull if you run > this script, cause it will delete files. It runs ok on files, but not > on directorys, my guess is that its because > i am on a win32 system? Also it looks like it translates the > structure as: > > d:\temp\huh/CME2_Course/EDU010_ClearCase/EDU010_Products_001.vbs/c > > where d:\temp\huh is base dir. That value actually comes from the > command line from Get::Opt. It doesnt work by doing d:/temp/huh > either. The Perl builtins do not care whether there are forward or backward slashes in paths. What exactly do you mean by "doesn't work on directories"? 1) I believe rmdir() will only delete empty directories. 2) If you delete a file in a directory the -M seems to change. This means that if you just deleted some files from the directory it cannot be deleted because it seems to be as recent as it can get. 3) On the other hand if you modify a file in a directory the modification time of the directory stays intact. This means that you may only delete directories that are empty for at least N days. At least that's how it seems for me. Maybe you do not want to delete old directories, but empty ones. Jenda =========== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ========== There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]