Tag: script

  • Bash: rename all files in directory, replacing all hyphens (-) with underscores (_)

    I don’t want to waste time doing things manually when I can run a script that will help me save time and effort.

    When using Linux or Mac command line (bash?), if you want to rename all files in your present directory and replace all hyphens - with underscores _, run this command:

    And if you want to do the reverse, i.e., replace all underscores _ with hyphens -, run this command instead:

    To remove substring from file names, (e.g., remove @3x string), run this:

    I had to do this after importing image files with hyphens in their names into my Android project. I can’t use images with hyphens in their names.

  • SSH: Basic usage of Shell Screen

    SSH: Basic usage of Shell Screen

    If you are often running scripts in SSH, especially ones that have a long execution time, you might have experienced termination of your script before it actually finishes its task(s). Maybe you closed the terminal window by accident, or you lost Internet connection for a moment.

    What you can do is run your script persistently with the help of Shell Screen.
    (more…)