This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Perl and the fly likes Not able to set file permissions using PERL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Languages » Perl
Bookmark "Not able to set file permissions using PERL" Watch "Not able to set file permissions using PERL" New topic
Author

Not able to set file permissions using PERL

Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
I have below simple perl script which sets sets all permissions to all type of users.




even I tried the 'system' command like shown in above script but when I run the script I am getting an error "chmod: WARNING: can't access /home/dummyuser/dummmy.txt".

Please suggest how to programatically set permissions on files in perl.


Thanks in advance.


RR Kumaran
SCJP 1.4
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
The error message seems to be saying that it simply can't access the named file. This might be for several reasons:

Does it exist? (I notice, for example, that the filename has three "m"s in it. Is that a typing error?)

Can the user running the script read/change the file (and its enclosing directory?) - try

and


The general answer is to try the commands from the command line first (making sure you are logged on as the user who runs the script), and see what happens.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Not able to set file permissions using PERL
 
Similar Threads
Executing shell script
Chmod from Runtime.Exec
Creating a file with proper permissions in linux - URGENT
log4j and file permissions
webapp permissions