Perl Directories - Perl Scripting

What are Perl Directories? How is it useful?

Following are the standard functions used to play with directories.

Display all the Files

There are many ways to list down all the files available in a specific directory. First we use the glob operator, to get and list down all the files with the glob operator −
Here is another example, which opens a directory and list out all the files available inside this directory.
One more example to print the list of C source files you might use is −

Create new Directory

You can use mkdir function to create a new directory. You will need to have the required permission to create a directory.

Remove a directory

You can use rmdir function to remove a directory. Permission is required to remove a directory. Additionally this directory should be empty before you want to remove it.

Change a Directory

You can use chdir function to change a directory and go to a new location. You will need to have the required permission to change a directory and can enter inside the new directory.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Perl Scripting Topics