Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
for f in "$@"; do new="$(echo -n "$f" | sed -E 's|/$||;s| +$||;s|^ +||;s|/ +([^/]+$)|/\1|;s| +(\.[^.][a-zA-Z0-9.]*)$|.\1|g'$|\1|g')"; mv "$f" "$new"; echo "$new"; done
(Paste as a Run Shell Script action and select Pass input: as arguments.)
for f in "$@"; do new="$(echo -n "$f" | sed -E 's|/$||;s| +$||;s|^ +||;s|/ +([^/]+$)|/\1|;s| +(\.[^.][a-zA-Z0-9.]*)$|.\1|g')"; mv "$f" "$new"; echo "$new"; done
(Paste as a Run Shell Script action and select Pass input: as arguments.)
for f in "$@"; do new="$(echo -n "$f" | sed -E 's|/$||;s| +$||;s|^ +||;s|/ +([^/]+$)|/\1|;s| +(\.[^.][a-zA-Z0-9.]*)$|\1|g')"; mv "$f" "$new"; echo "$new"; done
(Paste as a Run Shell Script action and select Pass input: as arguments.)
for f in "$@"; do new="$(echo -n "$f" | sed -E 's|/$||;s| +$||;s|^ +||;s|/ +([^/]+$)|/\1|;s| +\.+(\.[^.][a-zA-Z0-9\9.]*)$|.\1|g')"; mv "$f" "$new"; echo "$new"; done
(Paste as a Run Shell Script action and select Pass input: as arguments.)
for f in "$@"; do new="$(echo "$f" | sed -E 's|/$||;s| +$||;s|^ +||;s|/ +([^/]+$)|/\1|;s| +\.([^.][a-zA-Z0-9\.]*)$|.\1|g')"; mv "$f" "$new"; echo "$new"; done
(Paste as a Run Shell Script action and select Pass input: as arguments.)
for f in "$@"; do new="$(echo -n "$f" | sed -E 's|/$||;s| +$||;s|^ +||;s|/ +([^/]+$)|/\1|;s| +(\.[^.][a-zA-Z0-9.]*)$|.\1|g')"; mv "$f" "$new"; echo "$new"; done
(Paste as a Run Shell Script action and select Pass input: as arguments.)
Paste as a Run Shell Script action and select Pass input: as arguments:
for f in "$@"; do new="$(echo "$f" | sed -E 's|/$||;s| +$||;s|^ +||;s|/ +([^/]+$)|/\1|;s| +\.([^.][a-zA-Z0-9\.]*)$|.\1|g')"; mv "$f" "$new"; echo "$new"; done
Should work with:
somefile .tar.gz
EOL + ..plist
Terra Nova.S01E05.avi
../ somefile.txt
./somedir /
Doesn't work(Paste as expected with:a Run Shell Script action and select Pass input: as arguments.)
Terra Nova .S01E05.avi
Paste as a Run Shell Script action and select Pass input: as arguments:
for f in "$@"; do new="$(echo "$f" | sed -E 's|/$||;s| +$||;s|^ +||;s|/ +([^/]+$)|/\1|;s| +\.([^.][a-zA-Z0-9\.]*)$|.\1|g')"; mv "$f" "$new"; echo "$new"; done
Should work with:
somefile .tar.gz
EOL + ..plist
Terra Nova.S01E05.avi
../ somefile.txt
./somedir /
Doesn't work as expected with:
Terra Nova .S01E05.avi
for f in "$@"; do new="$(echo "$f" | sed -E 's|/$||;s| +$||;s|^ +||;s|/ +([^/]+$)|/\1|;s| +\.([^.][a-zA-Z0-9\.]*)$|.\1|g')"; mv "$f" "$new"; echo "$new"; done
(Paste as a Run Shell Script action and select Pass input: as arguments.)