idlehands has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to use backticks to run ls to search for files to gather a list of files that exist. End goal is to parse a group of iTune's playlist files to make sure when import the playlists to itunes it won't drop files if they don't exist. My problem is when I run ls in backticks with the file name, a \r is post pended to the command. making every file show up as not found.
$playListRow = quotemeta($playListRow); my $lscom = "ls $playListRow 2>&1"; my $result = `$lscom`;
this outputs: ls: /Volumes/public_files/music/ABC - The Lexicon of Love (1982) {1996 Remaster} V0what.cd/16 Look Of Love (Live).mp3\r: No such file or directory
No matter how I fiddle with it I can't get the \r to go away. Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: backtick iterpolation issue
by toolic (Bishop) on Jul 01, 2015 at 13:05 UTC | |
|
Re: backtick interpolation issue
by Athanasius (Cardinal) on Jul 01, 2015 at 13:47 UTC | |
|
Re: backtick iterpolation issue
by choroba (Cardinal) on Jul 01, 2015 at 13:03 UTC | |
by idlehands (Initiate) on Jul 01, 2015 at 13:43 UTC | |
by choroba (Cardinal) on Jul 01, 2015 at 13:49 UTC | |
|
Re: backtick iterpolation issue
by dave_the_m (Monsignor) on Jul 01, 2015 at 13:42 UTC | |
|
Re: backtick iterpolation issue
by 1nickt (Canon) on Jul 01, 2015 at 13:51 UTC | |
|
Re: backtick iterpolation issue
by trippledubs (Deacon) on Jul 01, 2015 at 13:59 UTC | |
|
Re: backtick iterpolation issue
by idlehands (Initiate) on Jul 01, 2015 at 17:01 UTC | |
by Laurent_R (Canon) on Jul 01, 2015 at 17:30 UTC | |
by 1nickt (Canon) on Jul 01, 2015 at 17:52 UTC |