# Help in batch script -chmod 777 command



## Codesearcher (May 13, 2009)

Hi all,
I am using the following code to FTP the xml files to the UNIX folder


@echo off
SetLocal
:: Set local folder you want to upload here.
Set _lcd=C:\Folder to upload
:: Will use current folder as a Temp folder for the FTP Script
Set _tmpfld=%~dp0
Set _tmpfld=%_tmpfld:~0,-1%
:: Set the Folder on the FTP server that you want to upload to
Set _FTPRoot=/bcmf/intin/
>"%_tmpfld%\ftpcmds.}t{" Echo open ftp.server.com
>>"%_tmpfld%\ftpcmds.}t{" Echo Username
>>"%_tmpfld%\ftpcmds.}t{" Echo password
>>"%_tmpfld%\ftpcmds.}t{" Echo cd "%_FTPRoot%"
>>"%_tmpfld%\ftpcmds.}t{" Echo lcd "%_lcd%"
>>"%_tmpfld%\ftpcmds.}t{" Echo binary
>>"%_tmpfld%\ftpcmds.}t{" Echo mput *.*
*>>"%_tmpfld%\ftpcmds.}t{" Echo chmod 777 *.xml*
>>"%_tmpfld%\ftpcmds.}t{" Echo quit
ftp -v -i -s:"%_tmpfld%\ftpcmds.}t{"
:: Delete the script
Del "%_tmpfld%\ftpcmds.}t{"
EndLocal

In the highlighted line i actually need to give 777 permission for all the files in the UNIX box once it is transferred.
But i get an error in this line which states "INVALID COMMAND"
I also tried with find "." -exec chmod 777 but its throwing out the same error.

Kindly help me to set the permissions.

regards,
coddy.


----------



## TheOutcaste (Mar 19, 2009)

Don't know a lot about the FTP Server side of things, but did some googling and got some ideas.

You could try SITE CHMOD 777 filename.xml
Might have to use lowercase: site chmod

Are you sure it's a Unix system you are uploading to? Does SYST Return as Unix, or also give invalid command?

Could be the CHMOD command has been disabled for some reason. You'd have to contact the FTP site Admin and make sure they support using CHMOD.

Jerry


----------



## Codesearcher (May 13, 2009)

yes you are right... Its surely a UNIX system i am uploading to and i get an error as invalid command 

But the chmod is working fine when i try try running the script thru Telnet.. so we cud confirm that CHMOD is not been disabled.


----------

