Welcome Guest! Log in
×

Notice

The forum is in read only mode.
Stambia versions 2.x, 3.x, S17, S18, S19 and S20 are reaching End of Support January, 15th, 2024. Please consider upgrading to the supported Semarchy xDI versions. See Global Policy Support and the Semarchy Documentation.

The Stambia User Community is moving to Semarchy! All the applicable resources have already been moved or are currently being moved to their new location. Read more…

Topic-icon Question Ftp get and file size

More
15 Feb 2016 16:44 #1 by Afaf ABOUTABIT
Ftp get and file size was created by Afaf ABOUTABIT
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
Replied by Thomas BLETON on 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
Replied by Afaf ABOUTABIT on 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
Replied by Thomas BLETON on 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).