how to get names of files in public folder javascript code example
Example 1: convert all files and folders in current directory into zip in linux
zip -r myfiles.zip mydir
Example 2: python script to read all file names in a folder
import os
def get_filepaths(directory):
"""
This function will generate the file names in a directory
tree by walking the tree either top-down or bottom-up. For each
directory in the tree rooted at directory top (including top itself),
it yields a 3-tuple (dirpath, dirnames, filenames).
"""
file_paths = []
for root, directories, files in os.walk(directory):
for filename in files:
filepath = os.path.join(root, filename)
file_paths.append(filepath)
return file_paths
full_file_paths = get_filepaths("/Users/johnny/Desktop/TEST")
Example 3: php get all php files in a directory
foreach(glob('includes/*.php') as $file) {
...
}
Example 4: how to get all folders on path in python
os.walk(directory)
[x[0] for x in os.walk(directory)]
Example 5: append a string in all files name linux
rename 's/^/1_/' *
where ^ is for starting of the file or end