Created
June 6, 2010 16:29
-
-
Save HNygard/427686 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Rename file to the name of parent folder | |
# Install nautilus-actions: | |
# http://ubuntuforums.org/showthread.php?t=91377 | |
# Only support 3 character file extention | |
extention=${1:(-4):4} | |
#echo $extention | |
# Getting name of the parent folder | |
parentdirectoryname=`dirname "$1" | tr / \\\\n | tail -1` | |
#echo $parentdirectoryname | |
directory=`dirname "$1"` | |
newname="${directory}/${parentdirectoryname}${extention}" | |
# Moving file | |
mv "$1" "$newname" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment