Skip to content
Snippets Groups Projects

urldecode.sh

  • Clone with SSH
  • Clone with HTTPS
  • Embed
  • Share
    The snippet can be accessed without any authentication.
    Authored by Charlie Morris
    Edited
    snippetfile1.txt 651 B
    #! /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
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment