in reply to File::Find on huge, dynamic filesystems?

One thing to keep in mind is that someone may access the file just as it is being compressed. This can result in corruption of the read data. The amount of corruption can be quite small, such as the loss of a single character at the end of the uncompressed file.

One possible way to fix this would be to change the permissions on the file, compress, and then change the permissions back.

It is unlikely that someone will access an old file at the same time that your program compresses it, but better to prevent the possibility altogether.

It should work perfectly the first time! - toma

  • Comment on Re: File::Find on huge, dynamic filesystems?

Replies are listed 'Best First'.
Re: File::Find on huge, dynamic filesystems?
by crenz (Priest) on Dec 11, 2002 at 20:27 UTC

    Changing the permissions would only work if you have your own user for the script -- say, you chown the file to yourself, chmod it to 600 and compress it, then change everything back. Why not just rename it? That would be atomic, plus if the renaming fails because the file or directory doesn't exist anymore, you can skip the compression step.