rename a directory you don't know the name of
I have this tarball named "master" and when extracted it creates a directory named "moeiscool-Shinobi-5eea744". It could be any name though depending on what version of "master" is downloaded at the current time.
In a bash script I want to rename "moeiscool-Shinobi-5eea744" to "shinobi", but I don't know what the actual name of the original directory will be. Initially I was thinking about TAB emulation, but I don't know if its the best way, and I might be over-complicating things. In bash, how would you rename a directory you don't know the name of? |
you need to know something about its name. For example it contains the word "shinobi" or you may know its location.
In such cases you can try to cd into its parent and execute: Code:
rename 's/.*shinobi.*/shinobi/i' *shinobi* |
another idea:
Code:
path1="/tmp/path1" should work in bash. |
All times are GMT -5. The time now is 05:05 PM. |