aspose file tools*
The moose likes Other Java Products and Servers and the fly likes Using setPermission  org.apache.commons.net.ftp.FTPFile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "Using setPermission  org.apache.commons.net.ftp.FTPFile" Watch "Using setPermission  org.apache.commons.net.ftp.FTPFile" New topic
Author

Using setPermission org.apache.commons.net.ftp.FTPFile

Nick Keay
Greenhorn

Joined: Apr 02, 2012
Posts: 1
Hi,

I'm using the apache ftp suite of packages for FTP'ing files over to a UNIX server from a Windows platform. After I've successfully got the file over to the Server, it has the following permission: "-rw-r--r--", which are User: Read Write, Group: Read, World: Read. I need the Group to have Read Write access to the files (for an Oracle process to pick it up).

So as a test I thought I’d loop over the directory, pick up my file, get the “hasPermission” to tell me what permissions it has then use “setPermission” to change it:



And this is what I get:

Got File: deenergised_001.txt
Has World Write permission: false
Has Group Write permission: false
Has User Write permission: true
Has Group Write permission: true


The problem is when I log back on to the UNIX Server, the file permissions remains as:

-rw-r--r-- 1 <username> users 97 Apr 2 12:21 deenergised_001.txt

What am I doing wrong? Is it only changing the permissions whilst the FTP session is in use (which would seem pretty useless)?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using setPermission org.apache.commons.net.ftp.FTPFile