Identify the upload status - perl

I am uploading the folder from local to FTP using perl Net::FTP::Recursive module. I have written the sample code below. In that code I need to know the status of the uploading process like whether it has been uploaded or not.
use strict;
use Net::FTP:recursive;
my $ftp_con= Net::FTP::Recursive->new('host.com',Debug=>0);
$ftp_con->login('username','password');
$ftp_con->rput('d:\my_test','\root\my_test');
$ftp_con->quit;
In the above code I am unable to find the status of the uploading. Can anyone suggest me to get the uploading status of the folder, whether the folder has been uploaded or not.
Thanks...

Subclass Net::FTP::Recursive to override _rput. Add a callback hook to the end of the foreach block and pass in the current file $file and the list of files #files as arguments.
In the main part of the code, count up each time the callback is called and calculating the progress from the counter and the number of elements in #files.

First thing did you remember what is your folder name that you transfer via ftf. If the transfering is so fast and you are unable to monitor wether it is already in the server, you can use anothet method to verify it wether it is successfully loaded.
1. Log in to CPanel of your website via your hosting provider
2. Locate legacy file manager folder then click
3. Choose document root for, the click Go, then start to see find your folder name that you tranfer via ftp.

Related

TFS 2013 build - uploading build output to servier via FTP

I'm hoping someone can help. I've started using the Community TFS Build Extensions, in particular the FTP activity. I followed the documentation here and got to grips with the it pretty easily. I'm encountering one major problem though.
My Web app has a basic enough structure:
I start by creating the FindMatchingFile activity which places the files in the drop location into an IEnumberable variable called FilesToFTP :
String.Format("{0}\**\*.*", BuildDetail.DropLocation)
When I iterate through the variable and print out the results, all seems correct:
G:\builds\Build.1203\CredentialManagement\bin\BusLogic.dll
G:\builds\Build.1203\CredentialManagement\css\style.css
G:\builds\Build.1203\CredentialManagement\AppError.aspx
......
G:\builds\Build.1203\CredentialManagement\Web.config
etc etc.
The problem is, when I pass that IEnumerable to the Ftp activity (converting it to a string array), it FTP uploads all the files on the server however it doesn't keep the directory structure of my Web app. It just piles all the output (dlls, aspx etc) into one directory. See the following two screenshots.
Is there any way I can use the FTP activity to upload all the output from the drop location recursively? I feel like I'm doing something simple wrong.
The FTP activity in TFS Build Extensions doesn't upload files recursively.
I think it would be a good value addition to the activity. Please create a request for the project and we will add in it. For now, you can go around it by calling the Ftp activity recursively for each directory and setting the RemoteDirectory for each.

Renaming file with filepicker.io

Here is my use case: the user will click a "save" link and will be presented with a filepicker.export() dialog, choose a location and name and save a file. Here's the exotic part: I won't have the file yet at that time. It needs to be downloaded first with a GET request, and then stored in filepicker. I won't know which file to start downloading until the user clicks "save".
This can be dealt with by first downloading the file when the user clicks "save", and only then displaying the filepicker.export() dialog. However, I find this cumbersome, since the user will have to wait for the download to finish to be able to choose a filename and location.
It would be much better to allow the user to first make their choice, for example "Dropbox/image.png", and store some sort of placeholder while the download is running: "Dropbox/image.png.part". Later, when the download finishes, I could write the data to the file and rename it to "Dropbox/image.png".
Here are my questions:
Is it possible to append ".part" to the filename that the user chose in the filepicker.export() call?
More importantly, while I know how to write to the file when the download is done, is there any way to rename it? I tried creating a new fpfile object with the same filepicker URL and a different filename, the new filename was ignored (though the write succeeded).
My recommendation would be to first call filepicker.export call on an empty file and allow the user to specify both the name of the file they would like and the location in their cloud storage. When the filepicker.export call finishes, it will pass an FPFile into the callback. From there, you can download any necessary contents you need and do a filepicker.write to save the contents to the location selected by the user.
There shouldn't be any need to rename the file, as the user has already provided the name they want to save the file under during the filepicker.export() call.

Creating folder on ftp if does not exist

I am interested to find out how to perform FTP asynchronously..
I am calling one method from the main view and then the main view navigates to some other view. Now the method that is called should perform the ftp process in the background without any issue.
I am not able to achieve this: http://www.iphonedevsdk.com/forum/iphone-sdk-development/41143-beginnersquestion-simpleftp-example.html
http://developer.apple.com/library/ios/#samplecode/SimpleFTPSample/Listings/URLGetController_h.html#//apple_ref/doc/uid/DTS40009243-URLGetController_h-DontLinkElementID_15
I have referenced this but is there any other way to do the FTP process?
I have files in a queue which are ftp one after the other in the async method.
I am sorry i am able to assist with your code but i can help with the ftp command side of things, if would recommend to try and changing into the directory that you are looking for with using CWD <\dirname> and look for the response: 550 <\dirname>: No such file or directory.
When you have recieved this response you will then be able to create the directory with using the command of MKD <\dirname> to create a directory.
Hope this helps ..

download multiple files using SimpleFTPSample

I've been trying to figure out how to download multiple files in a row based on the SimpleFTPSample provided by apple. Basically, I'm filtering what the user can see when they browse an ftp server, but when they select a certain file type, I want it to automatically check for another file of the same name with a different extension and if it exists, download it as well. I can't seem to get this second file to download no matter what I do. It seems strange because if I select two files in a row in my tableview, it downloads both of them just fine. Any ideas?
Edit:
It's just the SimpleFTPSample from apple.developer.com, all I did was create additional NSInputStream and NSOutputStream objects and I created a new _startReceiveFile method that gets called from _startReceive if I'm downloading a file instead of getting a directory listing. _startReceiveFile is the same code for _startReceive in the file download code for the sample project, except if the file to download has a certain extension, it also downloads an additional file with the additional stream objects. Let me know if I need to clarify more or try to put together a clear example.
Well, since there were no takers, I'll just post my solution here. I've abandoned trying to download two files at once. Instead, I just keep the ftp browsing window open and only handle the opening of the file once both files have been downloaded (user has clicked on each one separately). It's not what I wanted, but it will work, at least until I can figure out how to get two files with one request.

Non class files with Java Web Start

How do you distribute other files needed by your application that aren't in a jar file? For example, the application at http://www.javabeginner.com/java-swing/java-swing-shuffle-game . The download contains Shuffle.jar, Shuffle.bat, Score.dat, and an images folder with 3 images in it. I can see possibly putting the images directly in Shuffle.jar, but you wouldn't want to put Score.dat in the jar file because it changes. Is there somewhere you could identify this type of file in the jnlp?
The non-java files should be stored as resources. For files that change, you store the original or template file also as a resource in your jar. When the program starts, you have it check the local system to see if that file exists. If not, it creates the local file by copying the template file from the JAR resource. If the file already exists, then it is used as is.
To save files to the local system, even when running in the sandbox (unsigned), you can use the PersistenceService (javadoc / example). If your java application is signed, then you can use the regular File apis to write the file to the local machine, such as in a ".yourgame" subfolder under the user's home folder.
You can put all those files (except the scores file) in your jar file and load the contents using resource loading.
I've just deleted and restarted my reply twice now, changing my answer each time; this is confusing and needs a bit more clarification.
Are you SURE that application is supposed to be a Web Start app? On the site you linked to, it doesn't appear to be. Are you trying to take an application that was not designed as a Web Start application and change it into one that can be Web Start?
If it's not a Web Start app as your tag implies, then this question is open ended. You can distribute it 100 different ways.
If you are indeed trying to convert it into a Web Start app, you can start by packaging the images into the jar and that will alleviate your first headache if you just read them from there instead of from a File(). If it's going to be Web Start, then you need to decide how you want to keep scores. You have to decide what the scoring system is like before you can decide on how to go about it; will all the scores be kept on the web site hosting the Web Start app? Will that part still be local? If you want to get access to the local file system, you need to sign the jar, then you can extract the score.dat to the file system and do whatever you want with it if the end user accepts.
You need to figure out what you want to do before you can do it, or at least clear it up for us if you already know more than we know you know.