Professional Web Applications Themes

Removing a tempdir's on Windows - PERL Beginners

Hello, I am writing a custom log pr for our Squid proxy, and I have run into some problems with trying to use a temporary directory. The script ps all the logs, dumping those that are of interest to us for the various parts of the report to smaller, easier to handle files. I am using the following statement to create a temporary directory which works out great, removing most of the files, unfortunately I can not seem to make it remove all the files. our $templogs_base = 'C:\squid\var\log\SquidLog'; our $templogs = tempdir( DIR => $templogs_base, CLEANUP => 1 ); ...

  1. #1

    Default Removing a tempdir's on Windows

    Hello, I am writing a custom log pr for our Squid proxy, and I have
    run into some problems with trying to use a temporary directory. The
    script ps all the logs, dumping those that are of interest to us for
    the various parts of the report to smaller, easier to handle files. I
    am using the following statement to create a temporary directory which
    works out great, removing most of the files, unfortunately I can not
    seem to make it remove all the files.

    our $templogs_base = 'C:\squid\var\log\SquidLog';
    our $templogs = tempdir( DIR => $templogs_base, CLEANUP => 1 );


    When I run the script, I get the following errors:

    Can't unlink file C:\squid\var\log\SquidLog\5FIwr0r4nz/tmp-stb.com.txt: Permission denied at C:/SFU/Perl/lib/File/Temp.pm line 845
    Can't remove directory C:\squid\var\log\SquidLog\5FIwr0r4nz: Directory not empty at C:/SFU/Perl/lib/File/Temp.pm line 845

    I have thought about manually running unlink on all the files contained
    within that directory, however that seems like an ugly kludge to force
    the removal of the temporary directory.

    Can anyone shed some light on a clean way to do this?

    Tim Donahue


    Tim Guest

  2. #2

    Default Re: Removing a tempdir's on Windows

    Tim,
    You should close your file handles in your parsing code, before you unlink
    hth,
    Mark G

    ----- Original Message -----
    From: Tim Donahue <com>
    Date: Friday, September 10, 2004 2:58 pm
    Subject: Removing a tempdir's on Windows
     

    mgoland@optonline.net Guest

  3. #3

    Default Re: Removing a tempdir's on Windows

    Mark, you are correct it would help if I had closed the file handles.
    That is what I get for trusting a friend's code, and not reviewing all
    it when I add it to my project.

    Thanks for your help.

    Tim Donahue

    On Fri, 2004-09-10 at 15:05, net wrote: 
    >[/ref]

    Tim Guest

Similar Threads

  1. Removing red eye
    By Michael Rosen in forum Adobe Photoshop Elements
    Replies: 10
    Last Post: August 8th, 05:25 AM
  2. removing a windows xp home install
    By Nicholas in forum Windows XP/2000/ME
    Replies: 0
    Last Post: July 9th, 12:58 PM
  3. Removing desktop icon from one account is removing from all accounts
    By Kyle in forum Windows Setup, Administration & Security
    Replies: 1
    Last Post: July 3rd, 03:04 PM
  4. Removing XP
    By Jerry in forum Windows XP/2000/ME
    Replies: 3
    Last Post: July 1st, 04:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139