borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Interesting Web Site)Next Topic (how to use inet.execute to download a file) New Topic New Poll Post Reply
AndreaVB Forum : Internet Applications : How to change the chmod before or during ftp
Poster Message
Chidaz
Level: Whizz Kid


Registered: 29-06-2006
Posts: 15

icon How to change the chmod before or during ftp

My data extraction module reads data from the database (SQL) creates textfiles and ftp them to the internet via gprs modem. On the internet there is an asp program that reads the textfiles and after reading they are deleted.

My problem is how do i change the chmod from a VB program installed on a machine with Windows 2000. Is this possible to change before or during ftp the textfiles. If possible please help me!!!

[Edited by Chidaz on 30-06-2006 at 09:13 AM GMT]

[Edited by Chidaz on 30-06-2006 at 09:13 AM GMT]

[Edited by Chidaz on 30-06-2006 at 09:16 AM GMT]

30-06-2006 at 07:12 AM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 530
icon Re: How to change the chmod before or during ftp

I think you can change file permissions during an FTP session by using the command CHMOD.

when you have a connection established just send to the server the command "chmod 777 logfile.txt" where 777 is permission for read write and execute for every user group, followed by the name of the file you need to change the permissions...

hope this helps


____________________________
AndreaVB

30-06-2006 at 12:51 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
Chidaz
Level: Whizz Kid


Registered: 29-06-2006
Posts: 15
icon Re: How to change the chmod before or during ftp

Thanx for your reply, but i havent yet got it working. The following line of code is the one that i'm using to ftp my txt file:

.Execute , "PUT " & App.path & "\FileLocal.txt" & strFileFTP

So im not too sure where to specifythe chmod 777 command coz i tried it the way you explained to me, i cant get it working.

Cheers

03-07-2006 at 11:23 AM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 530
icon Re: How to change the chmod before or during ftp

try

.Execute ,"CHMOD 777 " & strFileFTP


if strFileFTP is the name of your file in the FTP server, be sure to be in the directory where the file is stored in the remote server maybe using CHDIR

[Edited by admin on 03-07-2006 at 01:15 PM GMT]

____________________________
AndreaVB

03-07-2006 at 12:14 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
Chidaz
Level: Whizz Kid


Registered: 29-06-2006
Posts: 15
icon Re: How to change the chmod before or during ftp

Now its giving me an error "The file specified cannot be found"
The line of code that i'm using is as follows:

.Execute , "PUT " & App.path & "\" & strFileLocal & strFileFTP

strFilelocal thus my txt file to ftp and strFileFTP, thus my path where i want the file to be stored.

Itried to code it as follows:

.Execute , "PUT " & App.path & "\" & "CHMOD 777" & strFileLocal & strFileFTP

when you execute that line of code, that error will be displayed.

04-07-2006 at 08:15 AM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 530
icon Re: How to change the chmod before or during ftp

why are you still using the "PUT" command in front of the string? put command is used to transfer a file to the ftp server, CHMOD is another command and it's used to change the permissions to a file and it has to be used alone. try using the string I suggested you!

before you send the command string put it into a variable to see how the string looks like


Dim s As String

s="CHMOD 777 " & strFileFTP
msgbox s 'see how's the command string you are sending
.Execute ,s


before using the CHMOD command be sure to be in the exact path where the file is stored, by moving inside the FTP server folders with "CHDIR <folder>" command.

an FTP server is like typing commands at the DOS prompt

____________________________
AndreaVB

04-07-2006 at 08:50 AM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
Chidaz
Level: Whizz Kid


Registered: 29-06-2006
Posts: 15
icon Re: How to change the chmod before or during ftp

How long do you think it will take to change the permissions, because now it seems i have created an infite loop

04-07-2006 at 09:56 AM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 530
icon Re: How to change the chmod before or during ftp

it should take some CPU clock cycles, what's happening? do you receive an answer to your CHMOD command? what's looping?

____________________________
AndreaVB

04-07-2006 at 12:22 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
Chidaz
Level: Whizz Kid


Registered: 29-06-2006
Posts: 15
icon Re: How to change the chmod before or during ftp

.Execute, "CHMOD 777" & strFileLocal & " " & strFileFTP
    Do While Inet1.StillExecuting = False
         DoEvents
         Call Sleep(5)
    Loop

It gets stuck on the loop

04-07-2006 at 01:31 PM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 530
icon Re: How to change the chmod before or during ftp

change your loop condition


    Do While Inet1.StillExecuting
         DoEvents
         Call Sleep(5)
    Loop


____________________________
AndreaVB

04-07-2006 at 03:29 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
Chidaz
Level: Whizz Kid


Registered: 29-06-2006
Posts: 15
icon Re: How to change the chmod before or during ftp

I have cahnge still infinite loop

05-07-2006 at 10:58 AM
View Profile Send Email to User Show All Posts | Quote Reply
admin
Level: Administrator


Registered: 04-04-2002
Posts: 530
icon Re: How to change the chmod before or during ftp

change the code as follows


.Execute, "CHMOD 777 " & strFileFTP
    Do While Inet1.StillExecuting
         DoEvents
         Call Sleep(5)
    Loop


...as I told you the CHMOD command needs only the name of the remote file on the ftp server...it changes only the permissions on the remote file!!!!

let me know

____________________________
AndreaVB

07-07-2006 at 01:04 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : Internet Applications : How to change the chmod before or during ftp
Previous Topic (Interesting Web Site)Next Topic (how to use inet.execute to download a file) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder