[Pdx-pm] command line question
Eric Wilhelm
ewilhelm at sbcglobal.net
Mon Jul 12 16:36:59 CDT 2004
# The following was supposedly scribed by
# Thomas J Keller
# on Monday 12 July 2004 04:24 pm:
>That doesn't work for this problem: replacing whitespace in filenames.
>But thanks.
>
?
rename 's/\s+/_/g' *
That would collapse any consecutive whitespace into a single underscore. Did
you want it to recurse? If so, see: find -name "* *" -exec <read manual>.
--Eric
>On Jul 12, 2004, at 2:16 PM, Colin Kuskie wrote:
>> On Mon, Jul 12, 2004 at 02:10:37PM -0700, Thomas J Keller wrote:
>>> This seems like one of those easy things easier ...things
>>> I want to rename all the files in a directory substituting an
>>> underscore for any spaces in the filename. I can write a program using
>>> IO::Dir, But it seems like that should be doable from the command
>>> line.
>>> Help?
>>> Thanks,
>>> Tom K.
>>
>> The original perl distribution used to include a program called rename
>> that allowed you to pass a line of perl code that would modify each
>> filename in any way you want.
>>
>> ren 'tr/ /_/;' *
--
"Unthinking respect for authority is the greatest enemy of truth."
--Albert Einstein
More information about the Pdx-pm-list
mailing list