Syntax:

CHMOD(mode,filename,SUBDIRS)

  • mode: unix file mode to apply.
  • filename: file name or wildcard expression.
  • SUBDIRS(optional): Use this parameter for changing the permissions of remote files contained in subdirectories. Note that if you supply this paramenter you will have to use a wildcard expression in the file name field.

Remarks:

  • If you want to apply CHMOD to a remote directory put the directory name in the file name field and append “/”. For example:
  • CHMOD(488,”/mydir/mysubdir/”)
  • Note that this command is only available on Unix FTP servers.

Command History:

ScriptFTP 2.0.1 Build 14 Feb 2006: Added support for applying CHMOD to directories.
ScriptFTP 2.0.1 Build 21 Feb 2006: Added the optional parameter SUBDIR for applying CHMOD to files in subdirectories.

Return Value:

CHMOD will return “OK” if the file permissions have been applied correctly. If it encounters an error it will return an error code.

Examples:

# Connect to server
OPENHOST("ftp.scriptftp.com","john","123456")
 
# Upload some files
PUTFILE("*.php",SUBDIRS)
 
# Apply 667 to index.php in the current remote directory
CHMOD(667,"index.php")
 
# Apply 777 to all php files in the current remote directory
CHMOD(777,"*.php")
 
# Apply 777 to all php files in the /cgi-bin/ directory
CHMOD(777,"/cgi-bin/*.php")
 
# Apply 777 to all php files in the /cgi-bin/
# directory and subdirectories
CHMOD(777,"/cgi-bin/*.php",SUBDIRS)
 
# Apply CHMOD to mysubdir
CHMOD(488,"/mydir/mysubdir/")
 
# Close connection
CLOSEHOST