From 8083cbddc5de47d3958e8f0af102d061fc5bcb25 Mon Sep 17 00:00:00 2001 From: Javi Corvi Date: Thu, 17 Nov 2022 10:18:37 +0100 Subject: [PATCH] version 2.0.2 split in folders --- pubmed_timed_retrieval.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pubmed_timed_retrieval.py b/pubmed_timed_retrieval.py index ef646a0..961dc69 100755 --- a/pubmed_timed_retrieval.py +++ b/pubmed_timed_retrieval.py @@ -162,9 +162,17 @@ def fetch_details(webenv, querykey, retstart, retmax, outputfolder, ids_list, re print ("Total abstracts in search query: " + str(count)) search_while=True first_time = True + counter=1 while (retstart < count): print ("Search from " + str(retstart) + " to " + str(retstart + retmax)) - results = fetch_details(webenv, querykey, retstart, retmax, args.o, ids_list, args.r, reldate) + subfolder = args.o + #just in case there were more than 10000, the folder split starts + if(count>10000): + subfolder = args.o + "/abstracts_"+ str(counter) + if not os.path.exists(subfolder): + os.makedirs(subfolder) + results = fetch_details(webenv, querykey, retstart, retmax, subfolder, ids_list, args.r, reldate) retstart=retstart+retmax + counter = counter + 1 print("Finish process")