Heh. Me too. In fact, one of the first things I did when I started using Perl 20 years ago (seems like only yesterday - how time flies!) was to write a script that made this easier, and it quickly grew to do any manner of command-line stuff where I needed any sort of substitution to make an "output" name from an "input" name: shloop -- execute shell command on a list.
Here's how I eliminate those pesky spaces from file names:
(Of course, there's a "-n" option for "no-op", to just print what would happen without actually doing it.)ls | grep " " | shloop -e rename -s 'tr: :_:'
It does get tricky when a directory has spaces in its name, and it also contains files with spaces in their names - renaming has to be done just one level at a time.
In reply to Re^2: Loading an array with file names
by graff
in thread Loading an array with file names
by insta.gator
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |