Welcome Guest! Log in
×

Notice

The forum is in read only mode.
Due to some maintenance operations, stambia.org will be switched to read-only mode during the 13th November. It will be possible to read and download, but impossible to post on the forums or create new accounts. For any question please contact the support team.

Topic-icon Question Ftp get and file size

More
15 Feb 2016 16:44 #1 by Afaf ABOUTABIT
Afaf ABOUTABIT created the topic: Ftp get and file size
Hello,

I am getting some files from an FTP server, and I want to do a sort of control to compare the size of these files before and after the upload to see if they were uploaded correctly.
The component Ftp GET stores some information about the uploaded files in a table of my schema. among these information there is the 'file_length'. I want to know whether this information matches the file size before or after the upload ?

my second question is : is there an option in the designer that can calculate for me the size of a given file ?

Thank you :)
More
16 Feb 2016 09:57 #2 by Thomas BLETON
Thomas BLETON replied the topic: Ftp get and file size
Hi :)

Normally if an error occurs during the FtpGet, the action should stop and raise an error. If you had issues with this behaviour feel free to share them with our support team.
The FtpGet action sets the "ind_session_file_op_lst.file_length" column with the downloaded file's size (after download, locally to the runtime).

For calculating a file size with the current versions of Stambia, simply use a rhino scripting action with a code like this one:
filePath = "d:/data/datafiles/employee.txt";
file = new java.io.File(filePath);
print(file.length());

Note that the next version of Stambia will have a new feature "propertyField" on the File metadata. It will allow to get file properties directly in mappings. An article will come soon on this subject.
More
16 Feb 2016 10:36 #3 by Afaf ABOUTABIT
Afaf ABOUTABIT replied the topic: Ftp get and file size
Thank you so much for your answer :)
So the "ind_session_file_op_lst.file_length" column refers to the file's size after the download, the local file's size.
Is there anyway to know what is the size of the file before the download ? the size of the file while it is on the ftp server ?
More
16 Feb 2016 11:16 #4 by Thomas BLETON
Thomas BLETON replied the topic: Ftp get and file size
This is really quite unusual :)
If the Get FTP action has no errors, then the File transfert protocol is successful and the distant file and the local are the same.
Have you encountered cases where this is not true ?

If you really want to get the file size on the server, try setting up a subprocess using the FtpCommand action. This action uses raw FTP commands (see for example www.nsftools.com/tips/RawFTP.htm , the SIZE command may help you).