0
0

指定されたディレクトリ以下のすべてのファイルのパスを再帰的に取得(Python)

Posted at
def get_file_list_recursive(directory_path):
  """
  指定されたディレクトリ以下のすべてのファイルのパスを再帰的に取得する

  Parameters:
  - directory_path (str): ファイルリストを取得するディレクトリのパス

  Returns:
  - list: ディレクトリ以下のすべてのファイルのパスを含むリスト
  """
  file_list = []
  for root, dirs, files in os.walk(directory_path):
      for file in files:
          file_list.append(os.path.join(root, file))
          
  return file_list
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0