makman111
asked on
Adding multiple files with similar names into a single zip folder
I have a lot of files with the same name but different extentions i.e.
b.txt
b.tx_
c.txt
c.tx_
d.txt
d.tx_
I need to have them zipped into a zip file with only the first part of the file name i.e.
b.zip
c.zip
d.zip
etc...
Does anyone know how to automate this? I have about 5000 files I need to do this for!
b.txt
b.tx_
c.txt
c.tx_
d.txt
d.tx_
I need to have them zipped into a zip file with only the first part of the file name i.e.
b.zip
c.zip
d.zip
etc...
Does anyone know how to automate this? I have about 5000 files I need to do this for!
perl -e '@F{map/([^.]+)/,<*.*>}=() ; system "zip $_ $_.*" for keys %F'
ASKER
I get...
'zip' is not recognized as an internal or external command, operable program or batch file.
'zip' is not recognized as an internal or external command, operable program or batch file.
ASKER
BTW: This is a XP machine.
What is the command for ziping b.txt and b.tx_ into b.zip on your XP machine?
perl -e "@F{map/([^.]+)/,<*.*>}=() ; system qq'zip $_ $_.*' for keys %F"
perl -e "@F{map/([^.]+)/,<*.*>}=()
ASKER
do you mean what is the command line for creating a zip?
ASKER
rar a <output filename> <input file 1> <input file2> <input file n>
i.e.
rar a a.zip a.txt a.tx_
i.e.
rar a a.zip a.txt a.tx_
perl -e "@F{map/([^.]+)/,<*.*>}=() ; system qq'rar a $_ $_.zip $_.*' for keys %F"
ASKER
Close - but I think the parameters are being imported wrong.
It should be:
wzzip <output name> <file 1> <file 2> -> wzzip a.zip a.txt a.tx_
Is there a way I can see what is being sent to the wzzip application?
It should be:
wzzip <output name> <file 1> <file 2> -> wzzip a.zip a.txt a.tx_
Is there a way I can see what is being sent to the wzzip application?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
How do I put the file name in quotes - that is the trick.
ASKER
perl -e "@F{map/([^.]+)/,<*.*>}=() ; system qq'wzzip \"$_.zip\" \"$_.*\"' for keys %F"
Does this trick Thanks!!!!!!!!!!
Does this trick Thanks!!!!!!!!!!
perl -e "push @{$F{(/([^.]+)/)[0]}},$_ for grep !/\.zip$/,<*.*>; print qq'wzzip $_.zip @{$F{$_}}\n' for keys %F"