Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

File::NCopy Problem

by nabeelfaruqui (Initiate)
on Aug 26, 2004 at 08:02 UTC ( [id://385931]=perlquestion: print w/replies, xml ) Need Help??

nabeelfaruqui has asked for the wisdom of the Perl Monks concerning the following question:

File NCopy cannot handle the folder name with spaces.. this is a serious bug. I either want the solution of that or the alternate . Thanks

Replies are listed 'Best First'.
Re: File::NCopy Problem
by Aragorn (Curate) on Aug 26, 2004 at 08:47 UTC
    It would help tremendously if you at least specify on which platform you're working. Also, I'd like solutions to all my problems too, but I'm afraid I'm not going to get them.

    But, I'm in a good mood as it's the birthday of my mother-in-law, so I'll provide a workaround which works at least on Linux and Apple OSX. You can use spaces in file/directory names by escaping the space characters with a backslash.

    #!/usr/local/bin/perl use strict; use warnings; use File::NCopy qw(copy); my $src = "Dir With Spaces"; my $dst = "Target_Dir"; # Escape whitespace characters $src =~ s/(\s)/\\$1/g; # Copy recursively copy \1, $src, $dst;

    Arjen

    Update:Fixed bug in regex

Re: File::NCopy Problem
by eserte (Deacon) on Aug 26, 2004 at 11:26 UTC
    From the File::NCopy SYNOPSIS it seems that the module supports glob pattern matching. I suspect it's using glob() for this task, which means that you have to escape all glob metacharacters including spaces.

    I think it would be a good feature to add an option to File::NCopy to not use glob() at all, but take the filenames as is. How about an entry in rt?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://385931]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-19 15:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found