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.
allows rapid copying of svgs from a srcDir to destDir
#!/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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment