Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

How do I create, move and delete files and folders?

by Anonymous Monk
on Mar 27, 2000 at 00:50 UTC ( [id://6192]=perlquestion: print w/replies, xml ) Need Help??

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

I would like to be able to make it so that a code can make a folder with a variable name and put certain files in it.

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: How do I create, move and delete files and folders?
by setantae (Scribe) on Mar 27, 2000 at 03:55 UTC
    You'll want to read up on mkdir, open, rename and unlink.

    Here's some example code. -- Ed.

    mkdir 'MyDir', 0777 or die "Oops, couldn't make dir: $!"; open FILE1, '>MyDir/test1.file' or die "Couldn't open file: $!"; print FILE1 'This goes in test1.file'; close FILE1; chdir 'MyDir'; rename 'test1.file', 'MyName.txt'; unlink 'MyName.txt';

Log In?
Username:
Password:

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

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

    No recent polls found