diff --git a/Python/Python_Get_all_files_from_directory.ipynb b/Python/Python_Get_all_files_from_directory.ipynb new file mode 100644 index 0000000000..d5d6260c04 --- /dev/null +++ b/Python/Python_Get_all_files_from_directory.ipynb @@ -0,0 +1,719 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "latin-packing", + "metadata": { + "execution": { + "iopub.execute_input": "2021-02-23T14:22:16.610471Z", + "iopub.status.busy": "2021-02-23T14:22:16.610129Z", + "iopub.status.idle": "2021-02-23T14:22:16.627784Z", + "shell.execute_reply": "2021-02-23T14:22:16.626866Z", + "shell.execute_reply.started": "2021-02-23T14:22:16.610384Z" + }, + "papermill": {}, + "tags": [] + }, + "source": [ + "\"Naas\"" + ] + }, + { + "cell_type": "markdown", + "id": "compressed-wilson", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "# Python - Get all files from directory\n", + "\n", + "\n", + "

💡 Template request | 🚨 Bug report" + ] + }, + { + "cell_type": "markdown", + "id": "religious-programmer", + "metadata": {}, + "source": [ + "**Tags:** #python #naas #glob #pprint " + ] + }, + { + "cell_type": "markdown", + "id": "1fe9f56e-561c-4f52-aef8-b861c9462107", + "metadata": {}, + "source": [ + "**Author:** [Ayoub Berdeddouch](https://www.linkedin.com/ayoub-berdeddouch)" + ] + }, + { + "cell_type": "markdown", + "id": "31ea7cdb-e10d-43fc-b026-f69249a59736", + "metadata": {}, + "source": [ + "**Description:** This notebook gives you the ability to get all files from a directory even in a sub-directory." + ] + }, + { + "cell_type": "markdown", + "id": "distinguished-truth", + "metadata": { + "papermill": {}, + "tags": [] + }, + "source": [ + "## Input\n", + "\n", + "* dir_path = \"\"\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "id": "numeric-mediterranean", + "metadata": {}, + "source": [ + "### Import libraries" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "potential-surfing", + "metadata": { + "execution": { + "iopub.execute_input": "2022-10-18T14:47:52.461238Z", + "iopub.status.busy": "2022-10-18T14:47:52.460925Z", + "iopub.status.idle": "2022-10-18T14:47:52.464786Z", + "shell.execute_reply": "2022-10-18T14:47:52.464130Z", + "shell.execute_reply.started": "2022-10-18T14:47:52.461205Z" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import glob\n", + "from pprint import pprint\n" + ] + }, + { + "cell_type": "markdown", + "id": "aggressive-trustee", + "metadata": {}, + "source": [ + "### Variables" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "continuous-melbourne", + "metadata": { + "execution": { + "iopub.execute_input": "2022-10-18T15:01:10.875403Z", + "iopub.status.busy": "2022-10-18T15:01:10.875175Z", + "iopub.status.idle": "2022-10-18T15:01:10.879503Z", + "shell.execute_reply": "2022-10-18T15:01:10.878863Z", + "shell.execute_reply.started": "2022-10-18T15:01:10.875381Z" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "# Input\n", + "# dir_path = dir_path\n", + "### All files and directories and that don't begin with a dot for a depth =1 \n", + "# depth = 1\n", + "\n", + "### # All files and directories with depth of 2 folders, ignoring names beginning with a dot for a depth =1 \n", + "# depth = 2\n", + "\n", + "# Output\n", + "# files = a list of all files and directories.\n", + "\n", + "dir_path =\"/home/ftp/awesome-notebooks/\"" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "26b3db26-8b9f-46d4-b5c4-8ff9d345878b", + "metadata": { + "execution": { + "iopub.execute_input": "2022-10-18T15:01:59.425368Z", + "iopub.status.busy": "2022-10-18T15:01:59.425138Z", + "iopub.status.idle": "2022-10-18T15:01:59.435031Z", + "shell.execute_reply": "2022-10-18T15:01:59.434392Z", + "shell.execute_reply.started": "2022-10-18T15:01:59.425343Z" + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['/home/ftp/awesome-notebooks/SendGrid', '/home/ftp/awesome-notebooks/INPI', '/home/ftp/awesome-notebooks/OpenWeatherMap', '/home/ftp/awesome-notebooks/spaCy', '/home/ftp/awesome-notebooks/Dash', '/home/ftp/awesome-notebooks/Microsoft Teams', '/home/ftp/awesome-notebooks/Pipedrive', '/home/ftp/awesome-notebooks/PyCaret', '/home/ftp/awesome-notebooks/BigQuery', '/home/ftp/awesome-notebooks/generate_readme.ipynb', '/home/ftp/awesome-notebooks/EM-DAT', '/home/ftp/awesome-notebooks/Hugging Face', '/home/ftp/awesome-notebooks/Vizzu', '/home/ftp/awesome-notebooks/Twilio', '/home/ftp/awesome-notebooks/README_template.md', '/home/ftp/awesome-notebooks/Matplotlib', '/home/ftp/awesome-notebooks/Insee', '/home/ftp/awesome-notebooks/Metrics Store', '/home/ftp/awesome-notebooks/YahooFinance', '/home/ftp/awesome-notebooks/Airtable', '/home/ftp/awesome-notebooks/Plotly', '/home/ftp/awesome-notebooks/Worldometer', '/home/ftp/awesome-notebooks/awesome.png', '/home/ftp/awesome-notebooks/WorldBank', '/home/ftp/awesome-notebooks/WSR', '/home/ftp/awesome-notebooks/Cityfalcon', '/home/ftp/awesome-notebooks/Reddit', '/home/ftp/awesome-notebooks/Bubble', '/home/ftp/awesome-notebooks/IMDB', '/home/ftp/awesome-notebooks/AlphaVantage', '/home/ftp/awesome-notebooks/US Bureau of Labor Statistics', '/home/ftp/awesome-notebooks/template.ipynb', '/home/ftp/awesome-notebooks/CSV', '/home/ftp/awesome-notebooks/PyPI', '/home/ftp/awesome-notebooks/CCXT', '/home/ftp/awesome-notebooks/Microsoft Word', '/home/ftp/awesome-notebooks/Trello', '/home/ftp/awesome-notebooks/Bazimo', '/home/ftp/awesome-notebooks/Knative', '/home/ftp/awesome-notebooks/Neo', '/home/ftp/awesome-notebooks/Python', '/home/ftp/awesome-notebooks/Affinity', '/home/ftp/awesome-notebooks/Gmail', '/home/ftp/awesome-notebooks/Snowflake', '/home/ftp/awesome-notebooks/FTP', '/home/ftp/awesome-notebooks/PDF', '/home/ftp/awesome-notebooks/Plaid', '/home/ftp/awesome-notebooks/Integromat', '/home/ftp/awesome-notebooks/MongoDB', '/home/ftp/awesome-notebooks/Instagram', '/home/ftp/awesome-notebooks/Remoteok', '/home/ftp/awesome-notebooks/FAO', '/home/ftp/awesome-notebooks/MySQL', '/home/ftp/awesome-notebooks/TikTok', '/home/ftp/awesome-notebooks/Typeform', '/home/ftp/awesome-notebooks/Spotify', '/home/ftp/awesome-notebooks/LinkedIn', '/home/ftp/awesome-notebooks/Celestrak', '/home/ftp/awesome-notebooks/Johns Hopkins', '/home/ftp/awesome-notebooks/Makefile', '/home/ftp/awesome-notebooks/FEC', '/home/ftp/awesome-notebooks/Slack', '/home/ftp/awesome-notebooks/AbstractAPI', '/home/ftp/awesome-notebooks/XML', '/home/ftp/awesome-notebooks/Qonto', '/home/ftp/awesome-notebooks/Excel', '/home/ftp/awesome-notebooks/Telegram', '/home/ftp/awesome-notebooks/Canny', '/home/ftp/awesome-notebooks/IPyWidgets', '/home/ftp/awesome-notebooks/Faker', '/home/ftp/awesome-notebooks/Societe.com', '/home/ftp/awesome-notebooks/Thinkific', '/home/ftp/awesome-notebooks/SAP-HANA', '/home/ftp/awesome-notebooks/Sendinblue', '/home/ftp/awesome-notebooks/LeFigaro', '/home/ftp/awesome-notebooks/Google Sheets', '/home/ftp/awesome-notebooks/Redshift', '/home/ftp/awesome-notebooks/Streamlit', '/home/ftp/awesome-notebooks/HTML', '/home/ftp/awesome-notebooks/Naas Auth', '/home/ftp/awesome-notebooks/Text', '/home/ftp/awesome-notebooks/Quandl', '/home/ftp/awesome-notebooks/_config.yml', '/home/ftp/awesome-notebooks/HubSpot', '/home/ftp/awesome-notebooks/Google Analytics', '/home/ftp/awesome-notebooks/Draft Kings', '/home/ftp/awesome-notebooks/YouTube', '/home/ftp/awesome-notebooks/README.md', '/home/ftp/awesome-notebooks/SharePoint', '/home/ftp/awesome-notebooks/GitHub', '/home/ftp/awesome-notebooks/ZIP', '/home/ftp/awesome-notebooks/Jupyter', '/home/ftp/awesome-notebooks/update_notebook.ipynb', '/home/ftp/awesome-notebooks/NASA', '/home/ftp/awesome-notebooks/Dask', '/home/ftp/awesome-notebooks/Naas', '/home/ftp/awesome-notebooks/Google Search', '/home/ftp/awesome-notebooks/Twitter', '/home/ftp/awesome-notebooks/LICENSE', '/home/ftp/awesome-notebooks/Boursorama', '/home/ftp/awesome-notebooks/IFTTT', '/home/ftp/awesome-notebooks/Elasticsearch', '/home/ftp/awesome-notebooks/Kaggle', '/home/ftp/awesome-notebooks/OwnCloud', '/home/ftp/awesome-notebooks/Pyvis', '/home/ftp/awesome-notebooks/Remotive', '/home/ftp/awesome-notebooks/Zapier', '/home/ftp/awesome-notebooks/Naas Dashboard', '/home/ftp/awesome-notebooks/AWS', '/home/ftp/awesome-notebooks/Pandas', '/home/ftp/awesome-notebooks/templates.json', '/home/ftp/awesome-notebooks/Healthchecks', '/home/ftp/awesome-notebooks/Pillow', '/home/ftp/awesome-notebooks/Notion', '/home/ftp/awesome-notebooks/Stripe', '/home/ftp/awesome-notebooks/D-Tale', '/home/ftp/awesome-notebooks/Newsapi', '/home/ftp/awesome-notebooks/Google Drive', '/home/ftp/awesome-notebooks/PostgresSQL', '/home/ftp/awesome-notebooks/PowerPoint', '/home/ftp/awesome-notebooks/Jupyter Notebooks', '/home/ftp/awesome-notebooks/IUCN', '/home/ftp/awesome-notebooks/Data.gouv.fr']\n" + ] + } + ], + "source": [ + "# Example with print(glob.glob(path))\n", + "print(glob.glob(dir_path+str('*')))" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "4fceca6f-d774-4d27-b2df-9fddc345eda7", + "metadata": { + "execution": { + "iopub.execute_input": "2022-10-18T15:02:00.051391Z", + "iopub.status.busy": "2022-10-18T15:02:00.051158Z", + "iopub.status.idle": "2022-10-18T15:02:00.065206Z", + "shell.execute_reply": "2022-10-18T15:02:00.064633Z", + "shell.execute_reply.started": "2022-10-18T15:02:00.051368Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['/home/ftp/awesome-notebooks/SendGrid',\n", + " '/home/ftp/awesome-notebooks/INPI',\n", + " '/home/ftp/awesome-notebooks/OpenWeatherMap',\n", + " '/home/ftp/awesome-notebooks/spaCy',\n", + " '/home/ftp/awesome-notebooks/Dash',\n", + " '/home/ftp/awesome-notebooks/Microsoft Teams',\n", + " '/home/ftp/awesome-notebooks/Pipedrive',\n", + " '/home/ftp/awesome-notebooks/PyCaret',\n", + " '/home/ftp/awesome-notebooks/BigQuery',\n", + " '/home/ftp/awesome-notebooks/generate_readme.ipynb',\n", + " '/home/ftp/awesome-notebooks/EM-DAT',\n", + " '/home/ftp/awesome-notebooks/Hugging Face',\n", + " '/home/ftp/awesome-notebooks/Vizzu',\n", + " '/home/ftp/awesome-notebooks/Twilio',\n", + " '/home/ftp/awesome-notebooks/README_template.md',\n", + " '/home/ftp/awesome-notebooks/Matplotlib',\n", + " '/home/ftp/awesome-notebooks/Insee',\n", + " '/home/ftp/awesome-notebooks/Metrics Store',\n", + " '/home/ftp/awesome-notebooks/YahooFinance',\n", + " '/home/ftp/awesome-notebooks/Airtable',\n", + " '/home/ftp/awesome-notebooks/Plotly',\n", + " '/home/ftp/awesome-notebooks/Worldometer',\n", + " '/home/ftp/awesome-notebooks/awesome.png',\n", + " '/home/ftp/awesome-notebooks/WorldBank',\n", + " '/home/ftp/awesome-notebooks/WSR',\n", + " '/home/ftp/awesome-notebooks/Cityfalcon',\n", + " '/home/ftp/awesome-notebooks/Reddit',\n", + " '/home/ftp/awesome-notebooks/Bubble',\n", + " '/home/ftp/awesome-notebooks/IMDB',\n", + " '/home/ftp/awesome-notebooks/AlphaVantage',\n", + " '/home/ftp/awesome-notebooks/US Bureau of Labor Statistics',\n", + " '/home/ftp/awesome-notebooks/template.ipynb',\n", + " '/home/ftp/awesome-notebooks/CSV',\n", + " '/home/ftp/awesome-notebooks/PyPI',\n", + " '/home/ftp/awesome-notebooks/CCXT',\n", + " '/home/ftp/awesome-notebooks/Microsoft Word',\n", + " '/home/ftp/awesome-notebooks/Trello',\n", + " '/home/ftp/awesome-notebooks/Bazimo',\n", + " '/home/ftp/awesome-notebooks/Knative',\n", + " '/home/ftp/awesome-notebooks/Neo',\n", + " '/home/ftp/awesome-notebooks/Python',\n", + " '/home/ftp/awesome-notebooks/Affinity',\n", + " '/home/ftp/awesome-notebooks/Gmail',\n", + " '/home/ftp/awesome-notebooks/Snowflake',\n", + " '/home/ftp/awesome-notebooks/FTP',\n", + " '/home/ftp/awesome-notebooks/PDF',\n", + " '/home/ftp/awesome-notebooks/Plaid',\n", + " '/home/ftp/awesome-notebooks/Integromat',\n", + " '/home/ftp/awesome-notebooks/MongoDB',\n", + " '/home/ftp/awesome-notebooks/Instagram',\n", + " '/home/ftp/awesome-notebooks/Remoteok',\n", + " '/home/ftp/awesome-notebooks/FAO',\n", + " '/home/ftp/awesome-notebooks/MySQL',\n", + " '/home/ftp/awesome-notebooks/TikTok',\n", + " '/home/ftp/awesome-notebooks/Typeform',\n", + " '/home/ftp/awesome-notebooks/Spotify',\n", + " '/home/ftp/awesome-notebooks/LinkedIn',\n", + " '/home/ftp/awesome-notebooks/Celestrak',\n", + " '/home/ftp/awesome-notebooks/Johns Hopkins',\n", + " '/home/ftp/awesome-notebooks/Makefile',\n", + " '/home/ftp/awesome-notebooks/FEC',\n", + " '/home/ftp/awesome-notebooks/Slack',\n", + " '/home/ftp/awesome-notebooks/AbstractAPI',\n", + " '/home/ftp/awesome-notebooks/XML',\n", + " '/home/ftp/awesome-notebooks/Qonto',\n", + " '/home/ftp/awesome-notebooks/Excel',\n", + " '/home/ftp/awesome-notebooks/Telegram',\n", + " '/home/ftp/awesome-notebooks/Canny',\n", + " '/home/ftp/awesome-notebooks/IPyWidgets',\n", + " '/home/ftp/awesome-notebooks/Faker',\n", + " '/home/ftp/awesome-notebooks/Societe.com',\n", + " '/home/ftp/awesome-notebooks/Thinkific',\n", + " '/home/ftp/awesome-notebooks/SAP-HANA',\n", + " '/home/ftp/awesome-notebooks/Sendinblue',\n", + " '/home/ftp/awesome-notebooks/LeFigaro',\n", + " '/home/ftp/awesome-notebooks/Google Sheets',\n", + " '/home/ftp/awesome-notebooks/Redshift',\n", + " '/home/ftp/awesome-notebooks/Streamlit',\n", + " '/home/ftp/awesome-notebooks/HTML',\n", + " '/home/ftp/awesome-notebooks/Naas Auth',\n", + " '/home/ftp/awesome-notebooks/Text',\n", + " '/home/ftp/awesome-notebooks/Quandl',\n", + " '/home/ftp/awesome-notebooks/_config.yml',\n", + " '/home/ftp/awesome-notebooks/HubSpot',\n", + " '/home/ftp/awesome-notebooks/Google Analytics',\n", + " '/home/ftp/awesome-notebooks/Draft Kings',\n", + " '/home/ftp/awesome-notebooks/YouTube',\n", + " '/home/ftp/awesome-notebooks/README.md',\n", + " '/home/ftp/awesome-notebooks/SharePoint',\n", + " '/home/ftp/awesome-notebooks/GitHub',\n", + " '/home/ftp/awesome-notebooks/ZIP',\n", + " '/home/ftp/awesome-notebooks/Jupyter',\n", + " '/home/ftp/awesome-notebooks/update_notebook.ipynb',\n", + " '/home/ftp/awesome-notebooks/NASA',\n", + " '/home/ftp/awesome-notebooks/Dask',\n", + " '/home/ftp/awesome-notebooks/Naas',\n", + " '/home/ftp/awesome-notebooks/Google Search',\n", + " '/home/ftp/awesome-notebooks/Twitter',\n", + " '/home/ftp/awesome-notebooks/LICENSE',\n", + " '/home/ftp/awesome-notebooks/Boursorama',\n", + " '/home/ftp/awesome-notebooks/IFTTT',\n", + " '/home/ftp/awesome-notebooks/Elasticsearch',\n", + " '/home/ftp/awesome-notebooks/Kaggle',\n", + " '/home/ftp/awesome-notebooks/OwnCloud',\n", + " '/home/ftp/awesome-notebooks/Pyvis',\n", + " '/home/ftp/awesome-notebooks/Remotive',\n", + " '/home/ftp/awesome-notebooks/Zapier',\n", + " '/home/ftp/awesome-notebooks/Naas Dashboard',\n", + " '/home/ftp/awesome-notebooks/AWS',\n", + " '/home/ftp/awesome-notebooks/Pandas',\n", + " '/home/ftp/awesome-notebooks/templates.json',\n", + " '/home/ftp/awesome-notebooks/Healthchecks',\n", + " '/home/ftp/awesome-notebooks/Pillow',\n", + " '/home/ftp/awesome-notebooks/Notion',\n", + " '/home/ftp/awesome-notebooks/Stripe',\n", + " '/home/ftp/awesome-notebooks/D-Tale',\n", + " '/home/ftp/awesome-notebooks/Newsapi',\n", + " '/home/ftp/awesome-notebooks/Google Drive',\n", + " '/home/ftp/awesome-notebooks/PostgresSQL',\n", + " '/home/ftp/awesome-notebooks/PowerPoint',\n", + " '/home/ftp/awesome-notebooks/Jupyter Notebooks',\n", + " '/home/ftp/awesome-notebooks/IUCN',\n", + " '/home/ftp/awesome-notebooks/Data.gouv.fr']\n" + ] + } + ], + "source": [ + "# Example with pprint(glob.glob(path))\n", + "pprint(glob.glob(glob.escape(dir_path) + \"*\"))" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "fd9d334c-9ea0-40ba-87ce-a5e13fbfe1e9", + "metadata": { + "execution": { + "iopub.execute_input": "2022-10-18T14:58:40.793996Z", + "iopub.status.busy": "2022-10-18T14:58:40.793776Z", + "iopub.status.idle": "2022-10-18T14:58:40.798155Z", + "shell.execute_reply": "2022-10-18T14:58:40.797534Z", + "shell.execute_reply.started": "2022-10-18T14:58:40.793973Z" + } + }, + "outputs": [], + "source": [ + "def get_files_dirs(path=dir_path,depth_1=True,depth_2=False):\n", + " \"\"\"\n", + " Input\n", + " Setup Variables\n", + " dir_path = \"\"\n", + "\n", + " Model\n", + " Get all files\n", + "\n", + " Output\n", + " Display result\n", + " print(files)\n", + " \"\"\"\n", + " files = []\n", + " if depth_1==True:\n", + " files = glob.glob(dir_path+str('*'))\n", + " pprint(files)\n", + " elif depth_2== True:\n", + " files = glob.glob(dir_path+str('*/*'))\n", + " pprint(files)\n", + " " + ] + }, + { + "cell_type": "markdown", + "id": "registered-showcase", + "metadata": {}, + "source": [ + "## Model" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "crude-louisville", + "metadata": { + "execution": { + "iopub.execute_input": "2022-10-18T14:59:58.649105Z", + "iopub.status.busy": "2022-10-18T14:59:58.648886Z", + "iopub.status.idle": "2022-10-18T14:59:58.667283Z", + "shell.execute_reply": "2022-10-18T14:59:58.666688Z", + "shell.execute_reply.started": "2022-10-18T14:59:58.649081Z" + }, + "papermill": {}, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['/home/ftp/awesome-notebooks/SendGrid',\n", + " '/home/ftp/awesome-notebooks/INPI',\n", + " '/home/ftp/awesome-notebooks/OpenWeatherMap',\n", + " '/home/ftp/awesome-notebooks/spaCy',\n", + " '/home/ftp/awesome-notebooks/Dash',\n", + " '/home/ftp/awesome-notebooks/Microsoft Teams',\n", + " '/home/ftp/awesome-notebooks/Pipedrive',\n", + " '/home/ftp/awesome-notebooks/PyCaret',\n", + " '/home/ftp/awesome-notebooks/BigQuery',\n", + " '/home/ftp/awesome-notebooks/generate_readme.ipynb',\n", + " '/home/ftp/awesome-notebooks/EM-DAT',\n", + " '/home/ftp/awesome-notebooks/Hugging Face',\n", + " '/home/ftp/awesome-notebooks/Vizzu',\n", + " '/home/ftp/awesome-notebooks/Twilio',\n", + " '/home/ftp/awesome-notebooks/README_template.md',\n", + " '/home/ftp/awesome-notebooks/Matplotlib',\n", + " '/home/ftp/awesome-notebooks/Insee',\n", + " '/home/ftp/awesome-notebooks/Metrics Store',\n", + " '/home/ftp/awesome-notebooks/YahooFinance',\n", + " '/home/ftp/awesome-notebooks/Airtable',\n", + " '/home/ftp/awesome-notebooks/Plotly',\n", + " '/home/ftp/awesome-notebooks/Worldometer',\n", + " '/home/ftp/awesome-notebooks/awesome.png',\n", + " '/home/ftp/awesome-notebooks/WorldBank',\n", + " '/home/ftp/awesome-notebooks/WSR',\n", + " '/home/ftp/awesome-notebooks/Cityfalcon',\n", + " '/home/ftp/awesome-notebooks/Reddit',\n", + " '/home/ftp/awesome-notebooks/Bubble',\n", + " '/home/ftp/awesome-notebooks/IMDB',\n", + " '/home/ftp/awesome-notebooks/AlphaVantage',\n", + " '/home/ftp/awesome-notebooks/US Bureau of Labor Statistics',\n", + " '/home/ftp/awesome-notebooks/template.ipynb',\n", + " '/home/ftp/awesome-notebooks/CSV',\n", + " '/home/ftp/awesome-notebooks/PyPI',\n", + " '/home/ftp/awesome-notebooks/CCXT',\n", + " '/home/ftp/awesome-notebooks/Microsoft Word',\n", + " '/home/ftp/awesome-notebooks/Trello',\n", + " '/home/ftp/awesome-notebooks/Bazimo',\n", + " '/home/ftp/awesome-notebooks/Knative',\n", + " '/home/ftp/awesome-notebooks/Neo',\n", + " '/home/ftp/awesome-notebooks/Python',\n", + " '/home/ftp/awesome-notebooks/Affinity',\n", + " '/home/ftp/awesome-notebooks/Gmail',\n", + " '/home/ftp/awesome-notebooks/Snowflake',\n", + " '/home/ftp/awesome-notebooks/FTP',\n", + " '/home/ftp/awesome-notebooks/PDF',\n", + " '/home/ftp/awesome-notebooks/Plaid',\n", + " '/home/ftp/awesome-notebooks/Integromat',\n", + " '/home/ftp/awesome-notebooks/MongoDB',\n", + " '/home/ftp/awesome-notebooks/Instagram',\n", + " '/home/ftp/awesome-notebooks/Remoteok',\n", + " '/home/ftp/awesome-notebooks/FAO',\n", + " '/home/ftp/awesome-notebooks/MySQL',\n", + " '/home/ftp/awesome-notebooks/TikTok',\n", + " '/home/ftp/awesome-notebooks/Typeform',\n", + " '/home/ftp/awesome-notebooks/Spotify',\n", + " '/home/ftp/awesome-notebooks/LinkedIn',\n", + " '/home/ftp/awesome-notebooks/Celestrak',\n", + " '/home/ftp/awesome-notebooks/Johns Hopkins',\n", + " '/home/ftp/awesome-notebooks/Makefile',\n", + " '/home/ftp/awesome-notebooks/FEC',\n", + " '/home/ftp/awesome-notebooks/Slack',\n", + " '/home/ftp/awesome-notebooks/AbstractAPI',\n", + " '/home/ftp/awesome-notebooks/XML',\n", + " '/home/ftp/awesome-notebooks/Qonto',\n", + " '/home/ftp/awesome-notebooks/Excel',\n", + " '/home/ftp/awesome-notebooks/Telegram',\n", + " '/home/ftp/awesome-notebooks/Canny',\n", + " '/home/ftp/awesome-notebooks/IPyWidgets',\n", + " '/home/ftp/awesome-notebooks/Faker',\n", + " '/home/ftp/awesome-notebooks/Societe.com',\n", + " '/home/ftp/awesome-notebooks/Thinkific',\n", + " '/home/ftp/awesome-notebooks/SAP-HANA',\n", + " '/home/ftp/awesome-notebooks/Sendinblue',\n", + " '/home/ftp/awesome-notebooks/LeFigaro',\n", + " '/home/ftp/awesome-notebooks/Google Sheets',\n", + " '/home/ftp/awesome-notebooks/Redshift',\n", + " '/home/ftp/awesome-notebooks/Streamlit',\n", + " '/home/ftp/awesome-notebooks/HTML',\n", + " '/home/ftp/awesome-notebooks/Naas Auth',\n", + " '/home/ftp/awesome-notebooks/Text',\n", + " '/home/ftp/awesome-notebooks/Quandl',\n", + " '/home/ftp/awesome-notebooks/_config.yml',\n", + " '/home/ftp/awesome-notebooks/HubSpot',\n", + " '/home/ftp/awesome-notebooks/Google Analytics',\n", + " '/home/ftp/awesome-notebooks/Draft Kings',\n", + " '/home/ftp/awesome-notebooks/YouTube',\n", + " '/home/ftp/awesome-notebooks/README.md',\n", + " '/home/ftp/awesome-notebooks/SharePoint',\n", + " '/home/ftp/awesome-notebooks/GitHub',\n", + " '/home/ftp/awesome-notebooks/ZIP',\n", + " '/home/ftp/awesome-notebooks/Jupyter',\n", + " '/home/ftp/awesome-notebooks/update_notebook.ipynb',\n", + " '/home/ftp/awesome-notebooks/NASA',\n", + " '/home/ftp/awesome-notebooks/Dask',\n", + " '/home/ftp/awesome-notebooks/Naas',\n", + " '/home/ftp/awesome-notebooks/Google Search',\n", + " '/home/ftp/awesome-notebooks/Twitter',\n", + " '/home/ftp/awesome-notebooks/LICENSE',\n", + " '/home/ftp/awesome-notebooks/Boursorama',\n", + " '/home/ftp/awesome-notebooks/IFTTT',\n", + " '/home/ftp/awesome-notebooks/Elasticsearch',\n", + " '/home/ftp/awesome-notebooks/Kaggle',\n", + " '/home/ftp/awesome-notebooks/OwnCloud',\n", + " '/home/ftp/awesome-notebooks/Pyvis',\n", + " '/home/ftp/awesome-notebooks/Remotive',\n", + " '/home/ftp/awesome-notebooks/Zapier',\n", + " '/home/ftp/awesome-notebooks/Naas Dashboard',\n", + " '/home/ftp/awesome-notebooks/AWS',\n", + " '/home/ftp/awesome-notebooks/Pandas',\n", + " '/home/ftp/awesome-notebooks/templates.json',\n", + " '/home/ftp/awesome-notebooks/Healthchecks',\n", + " '/home/ftp/awesome-notebooks/Pillow',\n", + " '/home/ftp/awesome-notebooks/Notion',\n", + " '/home/ftp/awesome-notebooks/Stripe',\n", + " '/home/ftp/awesome-notebooks/D-Tale',\n", + " '/home/ftp/awesome-notebooks/Newsapi',\n", + " '/home/ftp/awesome-notebooks/Google Drive',\n", + " '/home/ftp/awesome-notebooks/PostgresSQL',\n", + " '/home/ftp/awesome-notebooks/PowerPoint',\n", + " '/home/ftp/awesome-notebooks/Jupyter Notebooks',\n", + " '/home/ftp/awesome-notebooks/IUCN',\n", + " '/home/ftp/awesome-notebooks/Data.gouv.fr']\n" + ] + } + ], + "source": [ + "# Get all files\n", + "# we will use * to get all the files within a directory.\n", + "\n", + "# Note that glob ignores files and directories that begin with a dot ., as those are considered hidden files and directories, unless the pattern is something like .*.\n", + "\n", + "# Use glob.escape to escape strings that are not meant to be patterns:\n", + "\n", + "pprint(glob.glob(glob.escape(dir_path) + \"*\"))\n" + ] + }, + { + "cell_type": "markdown", + "id": "lonely-pacific", + "metadata": { + "execution": { + "iopub.execute_input": "2021-07-02T23:32:10.789097Z", + "iopub.status.busy": "2021-07-02T23:32:10.788829Z", + "iopub.status.idle": "2021-07-02T23:32:10.796900Z", + "shell.execute_reply": "2021-07-02T23:32:10.796358Z", + "shell.execute_reply.started": "2021-07-02T23:32:10.789033Z" + } + }, + "source": [ + "## Output" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "9c4e3b7b-6440-4844-8054-265f1aec65eb", + "metadata": { + "execution": { + "iopub.execute_input": "2022-10-18T15:00:32.244805Z", + "iopub.status.busy": "2022-10-18T15:00:32.244514Z", + "iopub.status.idle": "2022-10-18T15:00:32.269550Z", + "shell.execute_reply": "2022-10-18T15:00:32.268953Z", + "shell.execute_reply.started": "2022-10-18T15:00:32.244770Z" + }, + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['/home/ftp/awesome-notebooks/SendGrid',\n", + " '/home/ftp/awesome-notebooks/INPI',\n", + " '/home/ftp/awesome-notebooks/OpenWeatherMap',\n", + " '/home/ftp/awesome-notebooks/spaCy',\n", + " '/home/ftp/awesome-notebooks/Dash',\n", + " '/home/ftp/awesome-notebooks/Microsoft Teams',\n", + " '/home/ftp/awesome-notebooks/Pipedrive',\n", + " '/home/ftp/awesome-notebooks/PyCaret',\n", + " '/home/ftp/awesome-notebooks/BigQuery',\n", + " '/home/ftp/awesome-notebooks/generate_readme.ipynb',\n", + " '/home/ftp/awesome-notebooks/EM-DAT',\n", + " '/home/ftp/awesome-notebooks/Hugging Face',\n", + " '/home/ftp/awesome-notebooks/Vizzu',\n", + " '/home/ftp/awesome-notebooks/Twilio',\n", + " '/home/ftp/awesome-notebooks/README_template.md',\n", + " '/home/ftp/awesome-notebooks/Matplotlib',\n", + " '/home/ftp/awesome-notebooks/Insee',\n", + " '/home/ftp/awesome-notebooks/Metrics Store',\n", + " '/home/ftp/awesome-notebooks/YahooFinance',\n", + " '/home/ftp/awesome-notebooks/Airtable',\n", + " '/home/ftp/awesome-notebooks/Plotly',\n", + " '/home/ftp/awesome-notebooks/Worldometer',\n", + " '/home/ftp/awesome-notebooks/awesome.png',\n", + " '/home/ftp/awesome-notebooks/WorldBank',\n", + " '/home/ftp/awesome-notebooks/WSR',\n", + " '/home/ftp/awesome-notebooks/Cityfalcon',\n", + " '/home/ftp/awesome-notebooks/Reddit',\n", + " '/home/ftp/awesome-notebooks/Bubble',\n", + " '/home/ftp/awesome-notebooks/IMDB',\n", + " '/home/ftp/awesome-notebooks/AlphaVantage',\n", + " '/home/ftp/awesome-notebooks/US Bureau of Labor Statistics',\n", + " '/home/ftp/awesome-notebooks/template.ipynb',\n", + " '/home/ftp/awesome-notebooks/CSV',\n", + " '/home/ftp/awesome-notebooks/PyPI',\n", + " '/home/ftp/awesome-notebooks/CCXT',\n", + " '/home/ftp/awesome-notebooks/Microsoft Word',\n", + " '/home/ftp/awesome-notebooks/Trello',\n", + " '/home/ftp/awesome-notebooks/Bazimo',\n", + " '/home/ftp/awesome-notebooks/Knative',\n", + " '/home/ftp/awesome-notebooks/Neo',\n", + " '/home/ftp/awesome-notebooks/Python',\n", + " '/home/ftp/awesome-notebooks/Affinity',\n", + " '/home/ftp/awesome-notebooks/Gmail',\n", + " '/home/ftp/awesome-notebooks/Snowflake',\n", + " '/home/ftp/awesome-notebooks/FTP',\n", + " '/home/ftp/awesome-notebooks/PDF',\n", + " '/home/ftp/awesome-notebooks/Plaid',\n", + " '/home/ftp/awesome-notebooks/Integromat',\n", + " '/home/ftp/awesome-notebooks/MongoDB',\n", + " '/home/ftp/awesome-notebooks/Instagram',\n", + " '/home/ftp/awesome-notebooks/Remoteok',\n", + " '/home/ftp/awesome-notebooks/FAO',\n", + " '/home/ftp/awesome-notebooks/MySQL',\n", + " '/home/ftp/awesome-notebooks/TikTok',\n", + " '/home/ftp/awesome-notebooks/Typeform',\n", + " '/home/ftp/awesome-notebooks/Spotify',\n", + " '/home/ftp/awesome-notebooks/LinkedIn',\n", + " '/home/ftp/awesome-notebooks/Celestrak',\n", + " '/home/ftp/awesome-notebooks/Johns Hopkins',\n", + " '/home/ftp/awesome-notebooks/Makefile',\n", + " '/home/ftp/awesome-notebooks/FEC',\n", + " '/home/ftp/awesome-notebooks/Slack',\n", + " '/home/ftp/awesome-notebooks/AbstractAPI',\n", + " '/home/ftp/awesome-notebooks/XML',\n", + " '/home/ftp/awesome-notebooks/Qonto',\n", + " '/home/ftp/awesome-notebooks/Excel',\n", + " '/home/ftp/awesome-notebooks/Telegram',\n", + " '/home/ftp/awesome-notebooks/Canny',\n", + " '/home/ftp/awesome-notebooks/IPyWidgets',\n", + " '/home/ftp/awesome-notebooks/Faker',\n", + " '/home/ftp/awesome-notebooks/Societe.com',\n", + " '/home/ftp/awesome-notebooks/Thinkific',\n", + " '/home/ftp/awesome-notebooks/SAP-HANA',\n", + " '/home/ftp/awesome-notebooks/Sendinblue',\n", + " '/home/ftp/awesome-notebooks/LeFigaro',\n", + " '/home/ftp/awesome-notebooks/Google Sheets',\n", + " '/home/ftp/awesome-notebooks/Redshift',\n", + " '/home/ftp/awesome-notebooks/Streamlit',\n", + " '/home/ftp/awesome-notebooks/HTML',\n", + " '/home/ftp/awesome-notebooks/Naas Auth',\n", + " '/home/ftp/awesome-notebooks/Text',\n", + " '/home/ftp/awesome-notebooks/Quandl',\n", + " '/home/ftp/awesome-notebooks/_config.yml',\n", + " '/home/ftp/awesome-notebooks/HubSpot',\n", + " '/home/ftp/awesome-notebooks/Google Analytics',\n", + " '/home/ftp/awesome-notebooks/Draft Kings',\n", + " '/home/ftp/awesome-notebooks/YouTube',\n", + " '/home/ftp/awesome-notebooks/README.md',\n", + " '/home/ftp/awesome-notebooks/SharePoint',\n", + " '/home/ftp/awesome-notebooks/GitHub',\n", + " '/home/ftp/awesome-notebooks/ZIP',\n", + " '/home/ftp/awesome-notebooks/Jupyter',\n", + " '/home/ftp/awesome-notebooks/update_notebook.ipynb',\n", + " '/home/ftp/awesome-notebooks/NASA',\n", + " '/home/ftp/awesome-notebooks/Dask',\n", + " '/home/ftp/awesome-notebooks/Naas',\n", + " '/home/ftp/awesome-notebooks/Google Search',\n", + " '/home/ftp/awesome-notebooks/Twitter',\n", + " '/home/ftp/awesome-notebooks/LICENSE',\n", + " '/home/ftp/awesome-notebooks/Boursorama',\n", + " '/home/ftp/awesome-notebooks/IFTTT',\n", + " '/home/ftp/awesome-notebooks/Elasticsearch',\n", + " '/home/ftp/awesome-notebooks/Kaggle',\n", + " '/home/ftp/awesome-notebooks/OwnCloud',\n", + " '/home/ftp/awesome-notebooks/Pyvis',\n", + " '/home/ftp/awesome-notebooks/Remotive',\n", + " '/home/ftp/awesome-notebooks/Zapier',\n", + " '/home/ftp/awesome-notebooks/Naas Dashboard',\n", + " '/home/ftp/awesome-notebooks/AWS',\n", + " '/home/ftp/awesome-notebooks/Pandas',\n", + " '/home/ftp/awesome-notebooks/templates.json',\n", + " '/home/ftp/awesome-notebooks/Healthchecks',\n", + " '/home/ftp/awesome-notebooks/Pillow',\n", + " '/home/ftp/awesome-notebooks/Notion',\n", + " '/home/ftp/awesome-notebooks/Stripe',\n", + " '/home/ftp/awesome-notebooks/D-Tale',\n", + " '/home/ftp/awesome-notebooks/Newsapi',\n", + " '/home/ftp/awesome-notebooks/Google Drive',\n", + " '/home/ftp/awesome-notebooks/PostgresSQL',\n", + " '/home/ftp/awesome-notebooks/PowerPoint',\n", + " '/home/ftp/awesome-notebooks/Jupyter Notebooks',\n", + " '/home/ftp/awesome-notebooks/IUCN',\n", + " '/home/ftp/awesome-notebooks/Data.gouv.fr']\n" + ] + } + ], + "source": [ + "get_files_dirs(path=dir_path,depth_1=True,depth_2=False)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.6" + }, + "papermill": { + "default_parameters": {}, + "environment_variables": {}, + "parameters": {}, + "version": "2.3.3" + }, + "widgets": { + "application/vnd.jupyter.widget-state+json": { + "state": {}, + "version_major": 2, + "version_minor": 0 + } + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}