Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

by Anonymous Monk
on Mar 27, 2000 at 00:50 UTC ( #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.

  • Comment on How do I create, move and delete files and folders?

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
Node Status?
node history
Node Type: perlquestion [id://6192]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2021-04-21 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?