shadowcode Posted March 24, 2015 Posted March 24, 2015 Hello everyone am a new member here and i know that i shouldn't ask for help without giving something in return but this one is very important for me . i want to make something like this . i want to make a ftp script that would create a directory on the server with computer name and date something like this $date = @MDAY & "-" & @MON & "-" & @YEAR $Dir = _FTP_CreateDir(@ComputerName & "/" & $date) _FTP_FileSend($Server, $Username, $Password, $Save, "/" & @ComputerName & "/" & $date & "/" & $file) the previous script doesn't work can anyone find the mistake and help me ?? Thank you .
water Posted March 24, 2015 Posted March 24, 2015 Welcome to AutoIt and the forum! To be able to help you we need to see the whole script. At least the part where you connect to the target server. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
shadowcode Posted March 24, 2015 Author Posted March 24, 2015 (edited) $LogFileSize = FileGetSize($Save) While $LogFileSize = 100 $Num += 1 $Dir = _FTP_CreateDir(@ComputerName & "/" & $date) _FTP_FileSend($Server, $Username, $Password, $Save, "/" & @ComputerName & "/" & $date & "/" & $file) FileDelete($Save) Call("Logging") WEnd WEnd EndFunc ;==>Logging Func _FTP_FileSend($Server, $Username, $Password, $LocFile, $RemFile) $oFTP = _FTP_Open("myftp") $oConnect = _FTP_Connect($oFTP, $Server, $Username, $Password) _FTP_FilePut($oConnect, $LocFile, $RemFile) _FTP_Close($oFTP) EndFunc ;==>_FTP_FileSend Func _FTP_CreateDir($DirName) $oFTP = _FTP_Open("myftp") $oConnect = _FTP_Connect($oFTP, $Server, $Username, $Password) _FTP_DirCreate($oConnect, $DirName) _FTP_Close($oFTP) EndFunc ;==>_FTP_CreateDir --------------------------------------------------------------------------------------------------------- something might be wrong at this part $Dir = _FTP_CreateDir(@ComputerName & "/" & $date) _FTP_FileSend($Server, $Username, $Password, $Save, "/" & @ComputerName & "/" & $date & "/" & $file) ---------------------------------------------------------------------------------------------------------------------------------------------- thank you for your reply Edited March 24, 2015 by shadowcode
water Posted March 24, 2015 Posted March 24, 2015 You need to do some error checking. Every function either sets a return value or the amcros @error and extended. The _FTP* functions set @error if seomething went wrong. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
shadowcode Posted March 24, 2015 Author Posted March 24, 2015 if i want to make a directory with _FTP_CreateDir with computer name and $date how should i proceed ? does the above code seem ok
water Posted March 24, 2015 Posted March 24, 2015 A short example (untested): #include <FTPEx.au3> #include <MsgBoxConstants.au3> $oFTP = _FTP_Open("myftp") If @error Then Exit MsgBox($MB_ICONERROR, "Error", "_FTP_Open: Error " & @error & " occurred!") $oConnect = _FTP_Connect($oFTP, $Server, $Username, $Password) If @error Then MsgBox($MB_ICONERROR, "Error", "_FTP_Connect: Error " & @error & " occurred!") Else _FTP_DirCreate($oConnect, $DirName) If @error Then MsgBox($MB_ICONERROR, "Error", "_FTP_DirCreate: Error " & @error & " occurred!") EndIf _FTP_Close($oFTP) My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
shadowcode Posted March 24, 2015 Author Posted March 24, 2015 (edited) is this ok ? $date = @MDAY & "-" & @MON & "-" & @YEAR $directory = ("@ComputerName" & "/" & $date) $Dir = _FTP_CreateDir($directory) do you think this would work ? is anything wrong in my code ?? Edited March 24, 2015 by shadowcode
water Posted March 24, 2015 Posted March 24, 2015 Did you check @error after calling _FTP_CreateDir? What is the value? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
shadowcode Posted March 24, 2015 Author Posted March 24, 2015 (edited) _ftp_DirCreate: error -1 ocured Edited March 24, 2015 by shadowcode
water Posted March 24, 2015 Posted March 24, 2015 Ops, my fault. According to the docu the return value denotes error or success. What is the value of $Dir? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
shadowcode Posted March 24, 2015 Author Posted March 24, 2015 (edited) when i make it $dir = (@ComputerName & "-" & $date) it works it creates a directory with computername - date when i make it $dir = (@ComputerName & "/" & $date) it turns an error value i want that the date directory to be inside computername dir my only problem is that i dont know how to make dirs like hellofolder/secondfolder/thirdfolder inside the server Edited March 24, 2015 by shadowcode
Solution water Posted March 24, 2015 Solution Posted March 24, 2015 Seems you need to create two directories. First create "@ComputerName", then make this the new current directory and then create directory "$date". My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
shadowcode Posted March 24, 2015 Author Posted March 24, 2015 (edited) I did itttttttt thank you very very much Edited March 24, 2015 by shadowcode
water Posted March 24, 2015 Posted March 24, 2015 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now