removespaces.sh

enlever des espaces et autres caractères indésirables dans des noms de fichiers

#! /usr/bin/bash

# Script to replace spaces and other stuf from files
# Usage:
# remove_spaces.sh

# Authors:
# FR, fradeff@akademia.ch

# History
# 14.10.2015: FR, created
echo "This program will automatically convert spaces with underscores, and remove apostrophes and other punctuation marks"
echo "Which kind of files you want to replace? (eg. *.epub -> epub)"
read format
cd=`pwd`
cd $cd
echo "Current working directory:" $cd
echo "Current matching files:"
ls -1 *.$format
echo "rename 's/ /_/g' *.$format"
rename 's/ /_/g' *.$format
rename "s/'/_/g" *.$format
rename 's/"/_/g' *.$format
rename 's/,/_/g' *.$format
rename 's/;/_/g' *.$format
rename 's/:/_/g' *.$format
rename 's/__/_/g' *.$format
echo "Done, result:"
ls -1 *.$format
  • info/removespaces.sh.txt
  • Dernière modification: 2018/07/18 09:46
  • par radeff