Skip to content

Instantly share code, notes, and snippets.

@nicksteffens
Created April 4, 2023 20:24
Show Gist options
  • Save nicksteffens/b487c54d66bede9f01a743597d9beff1 to your computer and use it in GitHub Desktop.
Save nicksteffens/b487c54d66bede9f01a743597d9beff1 to your computer and use it in GitHub Desktop.

Revisions

  1. nicksteffens created this gist Apr 4, 2023.
    18 changes: 18 additions & 0 deletions copy-svgs.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    #!/bin/bash

    # Set the source and destination directories
    SRC_DIR="$1"
    DEST_DIR="$2"

    # Loop through all SVG files in the source directory
    for svg_file in "$SRC_DIR"/*.svg
    do
    # Get the filename without the path or extension
    filename=$(basename "$svg_file" .svg)

    # Prepend the directory name to the filename
    new_filename="$(basename $SRC_DIR)-$filename.svg"

    # Copy the file to the destination directory with the new filename
    cp "$svg_file" "$DEST_DIR/$new_filename"
    done