[Discuss] Spaces_in_file_names.
Noel Burton-Krahn
noel at burton-krahn.com
Sat Nov 25 21:38:46 PST 2006
The only problem with spaces is how the shell breaks up command-line
arguments. You just have to be careful. Keep in mind that "\t" and "\n" are
also valid filename characters, and Unicode filenames are coming soon, if
not there already. That's why find has a "-print0" argument and xargs has a
"-0" option.
That said, here's a perl program to replace " " with "_" in filenames
recursively
#! /usr/bin/perl -w
use File::Find;
finddepth(sub {
next unless s/ /_/g;
rename($File::Find::name, $_);
}, @ARGV);
--Noel
----- Original Message -----
From: "blackcrow" <blackcrow at shaw.ca>
To: <discuss at vlug.org>
Sent: Saturday, November 25, 2006 4:36 PM
Subject: [Discuss] Spaces_in_file_names.
> Greetings all.
>
> I spend quite a bit of time renaming various files, substituting spaces in
> file names with underscores. I wonder if there is a Linux "fix" for this?
> Perhaps a kernel_patch anyone knows about? OR, are we destined to rename
> our received_files from the Window$ world forever?
>
> Any ideas or comments?
>
> Thanks,
> Chris W.
> _______________________________________________
> Discuss mailing list
> Discuss at vlug.org
> http://ladybug.vlug.org/cgi-bin/mailman/listinfo/discuss
>
More information about the Discuss
mailing list