These are short bash scripts I wrote to delete characters mostly
from MP3, JPG, MP4, and DOC/TXT filenames
-------------
del-2dash
-------------
IFS=$(echo -en "\n\b")
for xdir in $(find . -type d | egrep "\-\-")
do mv -v $xdir ${xdir//--/-}
echo $xdir
done
for file in $(find . -type f | egrep "\-\-")
do mv -v $file ${file//--/-}
echo $file
done
-------------
-------------
del-ampersand
-------------
IFS=$(echo -en "\n\b")
for xfile in $(find . -type d)
do
echo $xfile | grep "\&" && {
echo changing $xfile;
mv -v "$xfile" ${xfile//\&/And}
}
done
for xfile in $(find . -type f)
do
echo $xfile | grep "\&" && {
echo changing $xfile;
mv -v "$xfile" ${xfile//\&/And}
}
done
-------------
-------------
del-comma
-------------
IFS=$(echo -en "\n\b")
for xdir in $(find . -type d | grep ",")
do mv -v $xdir ${xdir//,/-}
echo $xdir
done
for file in $(find . -type f | grep ",")
do mv -v $file ${file//,/-}
echo $file
done
-------------
-------------
del-dashdot
-------------
IFS=$(echo -en "\n\b")
for xdir in $(find . -type d | egrep "\-\.")
do mv -v $xdir ${xdir//-./.}
echo $xdir
done
for file in $(find . -type f | egrep "\-\.")
do mv -v $file ${file//-./.}
echo $file
done
-------------
-------------
del-dothtm
-------------
IFS=$(echo -en "\n\b")
for xdir in $(find . -type d | grep ".htm.")
do mv -v $xdir ${xdir//.htm./.}
echo $xdir
done
for file in $(find . -type f | grep ".htm.")
do mv -v $file ${file//.htm./.}
echo $file
done
-------------
-------------
del-fnspaces
-------------
IFS=$(echo -en "\n\b")
mv -v $1 ${1// /}
-------------
-------------
del-mp3s
-------------
IFS=$(echo -en "\n\b")
for file in $(find . -type f | grep "\.MP3-mono\.mp3")
do mv -v $file ${file//\.MP3-mono\.mp3/\.mp3}
done
for file in $(find . -type f | grep "\.mp3-mono\.mp3")
do mv -v $file ${file//\.mp3-mono\.mp3/\.mp3}
done
for file in $(find . -type f | grep "\.wav-mono\.wav")
do mv -v $file ${file//\.wav-mono\.mp3/\.mp3}
done
for file in $(find . -type f | grep "\.WAV-mono\.wav")
do mv -v $file ${file//\.WAV-mono\.mp3/\.mp3}
done
-------------
-------------
del-offical
-------------
IFS=$(echo -en "\n\b")
for xdir in $(find . -type d | grep -i "official")
do mv -v $xdir ${xdir//OfficialAudio/}
mv -v $xdir ${xdir//OfficialAudio/}
echo $xdir
done
for file in $(find . -type f | grep -i "official")
do mv -v $file ${file//OfficialAudio/}
mv -v $file ${file//OfficialAudio/}
echo $file
done
-------------
-------------
del-offical2
-------------
IFS=$(echo -en "\n\b")
for xdir in $(find . -type d | grep -i "official")
do mv -v $xdir ${xdir//OfficialAudio/}
mv -v $xdir ${xdir//OfficialAudio/}
echo $xdir
done
for file in $(find . -type f | grep -i "official")
do mv -v $file ${file//officialaudio/}
mv -v $file ${file//officialaudio/}
echo $file
done
-------------
-------------
del-paren
-------------
IFS=$(echo -en "\n\b")
for file in $(find . -type f)
do mv -v $file ${file//\(/} 2>> /dev/null
done
for file in $(find . -type f)
do mv -v $file ${file//\)/} 2>> /dev/null
done
-------------
-------------
del-periods
-------------
IFS=$(echo -en "\n\b")
for file in $(find . -type d | grep ".")
do
echo $file
mv -v $file ${file//./}
done
-------------
-------------
del-singlequote
-------------
IFS=$(echo -en "\n\b")
for xdir in $(find . -type d)
do
echo $xdir | grep "'" && {
echo changing $xdir;
mv -v "$xdir" "${xdir//\'/And}"
}
done
for xfile in $(find . -type f)
do
echo $xfile | grep "'" && {
echo changing $xfile;
mv -v "$xfile" "${xfile//\'/And}"
}
done
-------------
-------------
del-spaces
-------------
IFS=$(echo -en "\n\b")
for xdir in $(find . -type d | grep " ")
do mv -v $xdir ${xdir// /}
done
for xfile in $(find . -type f | grep " ")
do mv -v $xfile ${xfile// /}
done
-------------
-------------
del-sqbracket
-------------
IFS=$(echo -en "\n\b")
for xdir in $(find . -type d | grep "\[")
do mv -v $xdir ${xdir//\[/-}
echo $xdir
done
for file in $(find . -type f | grep "\[")
do mv -v $file ${file//\[/-}
echo $file
done
-------------
-------------
del-sqbracket2
-------------
IFS=$(echo -en "\n\b")
for xdir in $(find . -type d | egrep "\]")
do mv -v $xdir ${xdir//\]/}
echo $xdir
done
for file in $(find . -type f | egrep "\]")
do mv -v $file ${file//\]/}
echo $file
done
-------------
-------------
del-sync-conflicts
-------------
#!/usr/bin/bash
IFS=$(echo -en "\n\b")
for file in $(find . -type f | grep "sync\-conflict\-")
do echo "$file"
rm -rf "$file"
done
-------------
-------------
del-underscores
-------------
IFS=$(echo -en "\n\b")
for xdir in $(find . -type d | grep "_")
do mv -v $xdir ${xdir//_/-}
echo $xdir
done
for file in $(find . -type f | grep "_")
do mv -v $file ${file//_/-}
echo $file
done
-------------
2022-07-16
Various scripts to delete unnecessary odd characters from file names and directory/folder names
Subscribe to:
Post Comments (Atom)
Linux NetworkManager command line configuration
Configure Network Settings Using Network Manager in Linux Last updated: March 25, 2025 Written by:baeldung Network ConfigurationNetworkMana...
-
cat network-speed #!/usr/bin/bash # ethtool enp2s0 | grep Speed ethtool $1 | grep Speed # mii-tool -v enp2s0 mii-tool -v $1 network-speed ...
-
This script with it's two related configuration files worked on Raspberry Pi Raspbian Linux. What was always sketchy was the "dri...
-
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. #Warn ; Recommended for catching common errors. Send...
No comments:
Post a Comment