Rename rar file based on filename contained in it
Hello,
Have a question. I have multiple rar files with bad names say for example, "setup1.rar" and inside the rar is a better name like "Setup my folders.sh" got quite a few of these and would like to find a way to rename the rar file based on the filename inside so in the end I would have "Setup my folder.sh.rar" Any suggestions? |
you might want to use a descriptive name
the Microsoft default "setup" for EVERYTHING can be very annoying ,as in you have ZERO idea what it dose . and not use blank spaces in the names of shell scripts that is linux 101 just try to run this ??? Code:
sh ./Setup my folders.sh |
Quote:
|
This is what I cobbled together after a friend pointed me in the right direction with some help;
Code:
#!/bin/bash |
1. Do not use ls when simple globbing will not have issues with white space.
Code:
for i in *.rar 3. Redundant use of `echo` not required for variable substitution: Code:
mv "$i" "${f%.}.rar" |
All times are GMT -5. The time now is 09:55 PM. |