Question

Export a bunch of documents with their original file names

  • 29 May 2020
  • 4 replies
  • 819 views

Userlevel 1
Badge +3

I have added a bunch of documents to a selection (in Document Revisions). I may select one document and right click on it and select File Operations > Copy File To… and in the popup window Name Files Using… I may choose Original File Name (instead of Document Title and Name).

But when I select more than one document I don’t get the possibility to choose the original file names. The documents are all saved with IFS generated file names.

Would it be possible to, in one way or another, bulk export the documents with their original file names? If I am going to export ~50 documents it’s a time consuming process to export them each and each or rename them afterwards. They have to have their original filenames to match the names in another system.


4 replies

Userlevel 7
Badge +21

I would say that a post of me with an alternative to another question might be helpful here as well:

https://community.ifs.com/people-all-about-your-employees-38/document-attachments-1806?postid=7438#post7438

The trick here would be to derive the correct x (50 in this post) documents. Maybe an entry point can be documents in a specific document folder (standard functionality in IFS) or all the document numbers in a conversion list (part of basic data of Data Migration).

Steve

Userlevel 7
Badge +20

Hi @henfri ,

 

There are set of methods in batch_transfer_handler_api to download set of documents from IFS Document repository to a shared file location.

 

Below script will do the work for you :)

change the where condition to filter your documents.

Here, F:\fileshare\temp\ is a folder located in IFS Middleware Server. If you are need to download file to a shared folder, make sure IFS middleware server has full access to that location.

-- Created on 2019-07-03 by DSJ
declare
-- Local variables here
error_msg_ VARCHAR2(32000);

file_name_ varchar2(32000);

CURSOR get_rec is
SELECT * FROM edm_file_storage where doc_class = '109';

begin
-- Test statements here
FOR rec_ IN get_rec LOOP

file_name_ := edm_file_api.get_file_name(rec_.doc_class,
rec_.doc_no,
rec_.doc_sheet,
rec_.doc_rev,
rec_.doc_type);

batch_transfer_handler_api.download_from_db(error_msg_,
rec_.doc_class,
rec_.doc_no,
rec_.doc_sheet,
rec_.doc_rev,
rec_.doc_type,
rec_.file_no,
'F:\fileshare\temp\' || file_name_);

IF error_msg_ IS NULL THEN
dbms_output.put_line('success');
ELSE
dbms_output.put_line(error_msg_);
END IF;

END LOOP;
commit;
end;

 

Cheers!

Userlevel 5
Badge +10

If it is a one time thing, you can also use Windows Powershell, Navigate to the folder and use the following command to delete the “Copy of” Part.

Dir | Rename-Item -NewName {$_.name -replace "Copy of ",""}

If you have a text behind the document, you can also use the following command to remove the last part of a document name (in this case the last 32 characters)

Dir | Rename-Item -NewName {$_.name.substring(0,$_.BaseName.length-32) + $_.Extension}

 

 

Userlevel 1
Badge +3

Thanks for your answers! However, I had hoped to get a more simple solution, like click on that menu option and you are done or ask you administrator to adjust a setting in the IFS configuration.

Reply