All pastes #2080445 Raw Edit

Untitled

public shellscript v1 · immutable
#2080445 ·published 2011-09-09 04:41 UTC
rendered paste body
#! /bin/sh## newcomics_compressme contains about 40 subdirectories with names like "40" or "30.1". In each subdirectory are several image files.# What I want to do is turn this nested directory into a "flat" one, where what used to be /newcomics_compressme/30.1/4.png becomes /newoutput/30.1-4.png.# So my idea is..# For each directory ("40", "30.1", etc)for dir in */Users/SuitCase/Desktop/newcomics_compressme/;# Go through each file in it, and..for file in "$dir"/*;# Copy it out to newoutput, with the format "$dir-$file".do cp -- "$file" /Users/SuitCase/Desktop/newoutput/"$dir-$file";donedone# But my syntax must be wrong. This script gets # ./newcopy.sh: line 11: syntax error near unexpected token `for'# ./newcopy.sh: line 11: `for file in "$dir"/*;'