zim-wiki team mailing list archive
-
zim-wiki team
-
Mailing list archive
-
Message #04937
Re: Attachments management
-
To:
Alessia Moretti <alemim@xxxxxxxxx>, Marco Cevoli <marco.cevoli@xxxxxxxxx>
-
From:
Maik Mory <Mory@xxxxxxxxxxxxx>
-
Date:
Mon, 25 May 2020 08:47:30 +0000
-
Accept-language:
de-DE, en-US
-
Arc-authentication-results:
i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=dr-ecklebe.de; dmarc=pass action=none header.from=dr-ecklebe.de; dkim=pass header.d=dr-ecklebe.de; arc=none
-
Arc-message-signature:
i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=c4S8oPTT2B0Hgx6fIujWjCrZ4oFXzYvp2vlg+LpYyGU=; b=EV1RxnoBsLQJB3K9lmELbShO0JeAsKyx4X+gmDL9z+O+hZLJh0aob9Kv6sGeHoID10DDsVOAsWa4DTbZADqWfurRT1TCdTUjH05Wh8Yb1XaAyClYia4MK9SRJI8cHa8tDpMTvR19kIx1q/4KXK87mgfxZbLXi4Y9nVH+3/QsMtqUARL3jjPNBBS87UOplC0vj3Vf5cOu4nba/yxOCtXnNHW95wvz/dljmoAtNbaiquPKWMQUWGdzYtuYN+EVjuroHjpis4bZF4wk5a6rXjzj7AT3bwFOaeStGfCwO9tuugGauY2J+z3rTiTqURgvLWv8DaFvERYUiF55Ju07kNse0w==
-
Arc-seal:
i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TZIlyCZeDRyLMGa8j1FHt0c3g6vlKd4tOcrfmMuLDUvQ/QnT7og6Bp2PUI01sJE0vdbmBieQG6NFcuuiNFrlpFGBcvGIqQ7Q0sVSJDnfm6swYUX4zC+RITkjnlvEmzK9l14ueuAhN5usBfU+1zTK8WCsBk6lR1EDwB7g3f/dcit5x+EVrNtb/OeEU+VptJU1tWfFPvfGc9bL+7YIbKcrVg/KK7+vM3Q19LmS72Sp65pbdsB0JFS80wmmgZ4vtRfDb36QSYnpJ6GBMAfnxkgUfwOm82+DyPSf15ZPzlMzKY15odJ2rLkPHmyhzS6HQsoqVN24JguJ4q5Ss4Zb/5eEag==
-
Authentication-results:
gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=dr-ecklebe.de;
-
Cc:
Zim <zim-wiki@xxxxxxxxxxxxxxxxxxx>
-
In-reply-to:
<CAKiff8VXhjF57FWrPyUn53rxa+KdPLuuFCQ5NYxMTY744-bVQw@mail.gmail.com>
-
Thread-index:
AQHWMQbWXvFTnYN7qEiaSvY6sj3k86i1224AgAEtO4CAAW/swA==
-
Thread-topic:
[Zim-wiki] Attachments management
Hi folks.
Zim was developed with Python for a reason. When you are on Xubuntu, you are alreadily provided with a working python interpreter. From your answer – Alessia – I conclude that you are new to textual programming but without fear. Maybe you try this:
(1) apt install scite
(2) startup scite and create a file called count_zim_attachments.py
(3) insert some initial content into your python script
### start of file; exclude this line
#!/usr/bin/env python
import os
start_directory = '.' # i put the script right into my zim notebook and start it inside in *this* directory '.' you may note any path of a notebook or a subdirectory in a notebook between the single quotes.
total_attachments = 0
for current_directory, sub_directories, sub_files in os.walk('.'):
attachments = [f for f in sub_files if not f.endswith('.txt')]
total_attachments += len(attachments)
if attachments:
print('{} containts {} attachments.'.format(current_directory, len(attachments)))
print(20*'#')
print('{} attachments found in {}'.format(total_attachments, os.path.abspath(start_directory)))
### end of file; exclude this line
(4) Inside Scite press F5 key. Scite attempts to execute the script and presents the script and the script’s output (print) side by side. If you have any problems on this step, drop me a pm and I will assist you via Teams or Skype.
The script assumes, that any txt file is zim content. It assumes, that any non-txt-file is an attachment. Your mileage on these assumptions may vary.
Please do not hesitate to ask questions while adapting this script to your personal case.
Sincerely, mayk.
References
-
Searching on the server
From: Helder Guerreiro, 2020-05-08
-
Re: Searching on the server
From: Helder Guerreiro, 2020-05-13
-
Re: Searching on the server
From: Shivam Sharma, 2020-05-13
-
Re: Searching on the server
From: Gergely K., 2020-05-13
-
Re: Searching on the server
From: John R. Marks, IV, 2020-05-13
-
Re: Searching on the server
From: Marco Cevoli, 2020-05-13
-
Re: Attachments management
From: Alessia Moretti, 2020-05-23
-
Re: Attachments management
From: Marco Cevoli, 2020-05-23
-
Re: Attachments management
From: Alessia Moretti, 2020-05-24