Answers for "python get list of files in directory"

18

python list files in current directory

import os

files = os.listdir('.')
print(files)
for file in files:
  # do something
Posted by: Guest on November-04-2020
14

get list of folders in directory python

import os 
my_list = os.listdir('My_directory')
Posted by: Guest on June-08-2020
21

python read file list from directory

from shutil import copyfile
copyfile(src, dst)
Posted by: Guest on March-02-2020
8

list files in directory python

import os
print(os.listdir('/path/to/folder/to/list'))
Posted by: Guest on April-22-2020
5

python get all file names in a dir

from os import listdir
from os.path import isfile, join
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
Posted by: Guest on April-04-2020
0

python get list of files in directory

from os import listdir
file_list = listdir(folder_path)
Posted by: Guest on January-20-2021

Code answers related to "python get list of files in directory"

Python Answers by Framework

Browse Popular Code Answers by Language