Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Compressing files on an entire disk

by hippo (Bishop)
on Feb 07, 2023 at 16:29 UTC ( [id://11150214]=note: print w/replies, xml ) Need Help??


in reply to Compressing files on an entire disk

You can use File::Find::Rule (or any other of the similar tree-recursing modules) to create your list of files and then apply whatever per-file process you desire to each of them. That's how I would approach this task, anyway.

Note that you can extract single files from zip archives should you so wish, so you could still create just one big archive - in case that's an option.


🦛

  • Comment on Re: Compressing files on an entire disk

Replies are listed 'Best First'.
Re^2: Compressing files on an entire disk
by justin423 (Scribe) on Feb 07, 2023 at 20:27 UTC
    ok, I got the search to print a list of files, but I am getting a syntax error when I try to zip them individually.
    my @files = find( file => 'name' => [ ], size => '', in => $directory ); # @output="@files.zip"; my @status = zip @files => @output or die "zip failed: $ZipError\n";
      for my $src (@files) { my $status = zip $src => "${src}.zip" or die "zip failed: $ZipError\n"; } # And, if you're confident unlink @files;

      You cannot just arbitrarily throw arrays into subroutines which explicitly require scalar arguments and expect it to work.


      🦛

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-19 20:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found