You are not logged in.
Hi!
I am looking for help on creating a script that can take all the files in a folder and compress them
In example:
In a directory i have:
file1.iso
file2.jpeg
file7.doc
I want the script to create for me:
file1.iso.7z
file2.jpeg.7z
file7.doc.7z
Thanks!
Offline
for f in * ; do bzip2 $f ; done
Last edited by Spider.007 (2009-10-11 14:30:46)
Offline
Now ill look for the way to compress to 7z and thats all....
Thanks!!!!
Offline
for f in * ; do 7z a $f.7z $f ; done
probably?
Offline
That's what i was trying just now....... what to do for handling files with spaces in their names?
Sorry, Im a bit of a newb on bash scripting.... :S
Offline
for f in * ; do 7z a "$f.7z" "$f" ; done
ps http://tldp.org/LDP/abs/html/ is a good read
Offline
Yeah, that did the deal...
Thanks for the P.S...... i sure need to read it........
Offline
Use xz-utils, it's on your system anyway. p7zip is also LZMA but a different implementation (p7zip will be able to read xz archives though if I'm not mistaken).
Got Leenucks? :: Arch: Power in simplicity :: Get Counted! Registered Linux User #392717 :: Blog thingy
Offline