Skip to content

Instantly share code, notes, and snippets.

@RomaniukVadim
Created April 8, 2018 17:17
Show Gist options
  • Save RomaniukVadim/b19b35729eb4917cb6b417a4802f00d0 to your computer and use it in GitHub Desktop.
Save RomaniukVadim/b19b35729eb4917cb6b417a4802f00d0 to your computer and use it in GitHub Desktop.

Revisions

  1. RomaniukVadim created this gist Apr 8, 2018.
    10 changes: 10 additions & 0 deletions delete_shars.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    #!/bin/sh
    IFS=' '

    for file in *.mp3; do
    if [ ! -d "$file" ]; then
    newfilename=`echo "$file" | sed -e "s/ /_/g"`;
    new_name=`echo $newfilename |awk '{print substr($0,1,length-16)}'| xargs -I{} echo "{}.mp3"`;
    mv "$file" "$new_name" 2>/dev/null;
    fi
    done