command line CHMOD

Core FTP client questions and answers
Post Reply
blitzcreak
Posts: 2
Joined: Fri Feb 10, 2006 11:22 pm

command line CHMOD

Post by blitzcreak »

Okay, I'm getting myself into a knot here.

I wish to upload a directory call "logs", including its contents, and then change the permissions for the whole directory. This is what I have done:

Code: Select all

"C:\Program Files\CoreFTP\coreftp.exe" -u "C:\My Documents\12Xanadu\domain.com\logs"  ftp://username:password@domain.com  -p /public_html/  -chmod 777 
But when I do that, I get an error saying that it was unable to change the permissions as there was no file or directory named "logs". It does, however, successfully upload the files into a directory called logs, which it first creates.

What is the correct syntax to use?

Also, is it possible to have a command line that just changes the CHMOD without fist uploading anything?

Thanks

Noel
blitzcreak
Posts: 2
Joined: Fri Feb 10, 2006 11:22 pm

Post by blitzcreak »

I think I have solved it.

The command line CHMOD will only change the permissions on the destination directory if:

a. it exists
b. The source directory does not exist.

If the source directory exists, CoreFTP will upload the files it contains, and then will be unable to change the CHMOD on the directory. Why? because (as in my example) instead of trying to change the permissions on /public_html/_logs it tries to change them on /public_html/_logs/_logs which it then fails to find.

So to upload a directory that contains files, and to then set the CHMOD for that directory, these are the steps that have to be taken in a BAT file:

1. Upload the directory and the files it contains, If you wish, you can use the CHMOD command to change the permissions of any of these individual files, but using a separate upload command for each file.

2. rename the source directory so it does not exist.

3. upload the (non-existant) source directory and use the -chmod command

4. rename the source directory back to the original name

This would appear to be a bug in the command line utility!

Took me hours to figure this one out!

Noel
Post Reply