sed -i ‘s/text to be replaced/new text/g’ *
Extracts every rar file in the directory.
#!/bin/bash for f in *.rar; do echo "Processing $f" unrar x -y -p"password" $f done
Rename the files by removing special characters like spaces and other characters.
#!/bin/bash ls | while read -r FILE do mv -v "$FILE" `echo $FILE | tr '\[' ' ' | tr '\]' ' ' | tr '\)' ' ' | tr '(' ' ' | tr ' ' '_'`; done
Compress every sub-directory on the current directory to a zip file to the same name.
#!/bin/bash ls | while read -r FILE do zip -9 $FILE.zip $FILE/* done
Convert a files from a archive file type to the archive file tpye specified. The a atool package must installed to work.
#!/bin/bash arepack -e --format=$2 *.$1
Example: to convert all 7z files to zip files, use the command:
convert_archive 7z zip