CoderZone.org

Category: >> Perl Code >> Check If A Directory Allows File Creation Bookmark and Share

<< lastnext >>

Snippet Name: Check If A Directory Allows File Creation

Description: Use the following snippet to try and create a test file. If successful, it deletes the test file and prints "Permissions are OK." If not successful, it prints "Permission denied for writing files."

Also see:
» Write or update an htpasswd file i...
» Validate file extensions in upload...
» Javascript Include - allows dynami...
» Remove empty lines from a string o...
» Automatically find location of jav...
» Remove empty lines from text files
» Delete a file in Visual Basic
» Copy a file in VB
» Reading and Writing to text files ...
» Parsing PHP in Javascript Files
» Perl version of file_get_contents&...
» Create an array from words in an H...
» Read the contents of an entire fil...
» Create an array from the contents ...
» Create an array from the lines of ...
» Create an array from comma separat...
» Create an array from a range of le...
» Remove Duplicate Lines from a File
» Extract Just The BODY Of An HTML F...
» Rename Files Interactively
» Sort A File List By Month Name In ...
» Get File Size Over HTTP
» Get A Directory Listing Of Specifi...
» Copy Files By Date Modified
» Output To STDOUT Or A File
» Create Filler Text
» Dynamically create HTML elements
» Include All Files In A Directory
» More File Type Detection in PHP

Comment: (none)

Author: CoderZone
Language: PERL
Highlight Mode: PERL
Last Modified: December 02nd, 2010

my $filename = 'test.txt';
if(open T,">$filename"){
  close T;
  unlink "$filename"';
  print 'Permissions are OK.';
}else{ 
  print 'Permission denied for writing files.' }
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 8