Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: delete old files (windoze)

by kutsu (Priest)
on Oct 15, 2004 at 14:01 UTC ( [id://399505]=note: print w/replies, xml ) Need Help??


in reply to delete old files (windoze)

Do the files exist and is your test server running windows? On command line type locate filename for linux or dir /s /p filename on windows (may have to do a cd \ before hand).

"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce

Replies are listed 'Best First'.
Re^2: delete old files (windoze)
by softworkz (Monk) on Oct 15, 2004 at 14:22 UTC
    I tried dir /s /p within the directory (not found) I'm beginning to suspect SPACES in file names..

      If you were in the TEMP directory and did a dir /s /p and found nothing...TEMP is empty, it has nothing to do with spaces in the filename. I would guess this works on your local machine because you don't clean out the TEMP directory, on a server (even a test server) this proably isn't the case and your files are getting deleted, which is one of the many reasons you shouldn't put non-temporary files in a temp directory. However, if you don't even understand the basic function dir (like how to find files with spaces in their names), I suggest you take some time and learn about your OS.

      "Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce

        I guess I should have been MORE informative about my OS. Here's what I have. I have windoze 2003 ent and the hard drive is partitioned C:\ and T:\temp. I run Perl on both a 32bit and 64bit windoze servers.

        Now back to the problem at hand. Run this code if you have your hard drive partitioned and you will see it fail then get back with me with suggestions.
        #!/usr/bin/perl -w use strict; use File::Find; use File::stat; my $path = "T:\\"; find (\&wanted, $path); sub wanted { my $days = 10; my $stat = stat($_); # Access and Modified dates older then X days and not root if (-A $_ > $days && -M $_ > $days && !(/^\./) ){ # With a temp partition T:\ there are system files that can't +be deleted if (!($_ =~ /^ntldr.*|nprotect.*|ntdetect.*|System.*|VIRTPART. +*|.ini/i)) { printf "access date %s modify date %s File is %s\n", scala +r localtime $stat->atime, scalar localtime $stat->mtime, $_; # unlink($_); } } }
        I think I've found the problem, the temp directory is a partition of the c:\ and File::Find is finding the directory System Volume Information which is a hidden folder on c:\, is there any way to make it not find it? thanks!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://399505]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (7)
As of 2024-04-18 11:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found