/ Published in: Bash
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/bin/bash SOURCE_DIR="~/Desktop/in" SOURCE_DIR_NAME=`basename "$SOURCE_DIR"` SUFFIX="_l" TARGET_DIR="~/Desktop/out" find "$SOURCE_DIR" | while read file; do baseName=`basename "$file"` if [[ ${baseName:0:1} == "." || "$baseName" == "$SOURCE_DIR_NAME" ]]; then continue fi NAME=`echo "$baseName" | cut -d'.' -f1` EXTENSION=`echo "$baseName" | cut -d'.' -f2` cp "$file" "$TARGET_DIR/$NAME$SUFFIX.$EXTENSION" done exit 0