[lug] Newline in a filename

Timothy C. Klein teece at silverklein.net
Sun Nov 11 11:20:24 MST 2001


* Tkil (tkil at scrye.com) wrote:
> the easiest way is to just use a wildcard; this is what the question
> mark is hinting at, anyway:

I figured this would work, I was just curious about other ways.
 
> if you have many of them to get rid of, you could look at "find" with
> the "-print0" option, feeding into "xargs" with the "-0" flag:

Luckily, I was wise enough to test the script on unimportant data, on a
small sample.  Otherwise I would have been in *real* trouble.
 
> finally, you could just use perl again:
> 
> | $ perl -e 'unlink "foo\nbar"'

This is a great idea, I had not thought of.  Thanks
 
> p.s. for renaming files, i wrote a perl script i called "pmv".  it
>      accepts a regular expression as its first argument, and an
>      arbitrary perl expression as its second argument.  this is very
>      handy for e.g. lowercasing a bunch of filenames:

This is cool.  I was just thinking about writing such a beast.  The
script I am writing right now is to help me keep track of the pictures I
take with my digital camera.  I also scan slides from my SLR, so I built
in features to name files such that I recognize where the came from by
the name.  Thus, this tool is for a very specific task.  I was wanting
to write a general one, though, just to help be get better at Perl.  I
am still pretty new to the language.

Thanks

Tim
--
==============================================
== Timothy Klein || teece at silverklein.net   ==
== ---------------------------------------- ==
== "Hello, World" 17 Errors, 31 Warnings... ==
==============================================



More information about the LUG mailing list