urldecode.sh
The snippet can be accessed without any authentication.
Authored by
Charlie Morris
Edited
#! /bin/bash
# FILES equals the files you are planning on renaming (i.e., removing "%20" from
# Example provided
FILES="09-10_%20Central.xls
2012-%20faculty-retreat-breakout-groups.pdf
accessdepartment2012updated%20tacticalplan.doc
Agenda%20for%20Collection%20Development%20Retreat2010.doc
AH%20Traning%20Manual%20v17.pdf
Wage_Annual%20evaluation%20form.doc"
# Use glorious PHP to hande the decoding of your URLs
# Run this inside the directory where your files live
for file in $FILES
do
echo -e "\n\nProcessing $file..."
echo "$file"
NEW_FILE_NAME=$(php -r "echo urldecode('$file');")
echo "$NEW_FILE_NAME"
mv "$file" "$NEW_FILE_NAME"
done
Please register or sign in to comment