Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: create directory with input

by LanX (Saint)
on Dec 03, 2017 at 11:33 UTC ( [id://1204793]=note: print w/replies, xml ) Need Help??


in reply to create directory with input

\backslashes escape inside Perl strings and things like "\U" mean uppercase the following characters.

Maybe try to escape the backslashes

 "C:\\Users\\darkblack\\...

or use Unix style paths.

 "C:/Users/darkblack/...

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^2: create directory with input
by darkblackblue (Novice) on Dec 03, 2017 at 12:55 UTC
    It didnt work when I used
    my $dir = "C:\\Users\\darkblack\\Desktop\\".$directory_name; or my $dir = "C:\\Users\\darkblack\\Desktop\\.$directory_name";
      It didnt work

      What was the error message,"Invalid argument" ?. Try adding chomp

      #!perl use strict; use warnings; my $cwd = 'C:/Users/darkblack/Desktop'; print "Enter directory name > "; chomp(my $dir = <STDIN>); $dir = "$cwd/$dir"; mkdir( $dir , 0755 ) or die "Could not create $dir : $!"; print "Directory $dir created successfully\n";
      poj
        Thank , Its works.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-24 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found