List only file names in directories and subdirectories in bash

TheRunner565

I need to create a list of files in a directory and all of its subdirectories. I've used

find . -type f

to get the list of files, but I only need the file name, not the path that leads to it.

So instead of returning this:

./temp2/temp3/file3.txt
./temp2/file2.txt
./file.txt

I need to return

file3.txt
file2.txt
file.txt
Eduardo
find . -type f -exec basename {} \;

or better yet:

find . -type f -printf "%f\n"

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

bash: use list of file names to concatenate matching files across directories and save all files in new directory

From Dev

How to list only the file names in HDFS

From Dev

Comparing (diff) different files with same names in lots of directories and subdirectories

From Dev

How to add a list of directories and subdirectories to a QStringList?

From Dev

find command in bash script resulting in "No such file or directory" error only for directories?

From Dev

Powershell script for comparing two directories based on file names only

From Dev

How to get list of subdirectories names

From Dev

Batch copy a specific file to all directories and subdirectories

From Dev

How can I create a table with names of directories and subdirectories in R?

From Dev

Bash script to create multiple directories and Subdirectories

From Dev

Python: List directories/sub-directories with file names

From Dev

Bash script to create multiple directories and Subdirectories

From Dev

Linux: delete all directories with only one file and no subdirectories

From Dev

How to copy a list files to a list of directories or subdirectories

From Dev

How to list only filenames removing directories and subdirectories

From Dev

List files in subdirectories but don't list directories

From Dev

bash grep file directories

From Dev

Powershell script for comparing two directories based on file names only

From Dev

How can I list all files, but only in directories that have no subdirectories?

From Dev

Shell script to create directories and files from a list of file names

From Dev

BASH find file names but skip a list of file names

From Dev

Writing List<String> of Directories with Subdirectories

From Dev

Rename file names in multiple directories

From Dev

Loop through directories and subdirectories in bash

From Dev

How to find only directories without subdirectories?

From Dev

bash list all directories, subdirectories, folders, subfolders in then output to a separate file

From Dev

List file names in order of file size in BASH

From Dev

How to run a bash script only on directories that have no subdirectories

From Dev

Copy all files from subdirectories and subsubdirectories to main directory with modifying file names by adding prefix of all parent directories

Related Related

  1. 1

    bash: use list of file names to concatenate matching files across directories and save all files in new directory

  2. 2

    How to list only the file names in HDFS

  3. 3

    Comparing (diff) different files with same names in lots of directories and subdirectories

  4. 4

    How to add a list of directories and subdirectories to a QStringList?

  5. 5

    find command in bash script resulting in "No such file or directory" error only for directories?

  6. 6

    Powershell script for comparing two directories based on file names only

  7. 7

    How to get list of subdirectories names

  8. 8

    Batch copy a specific file to all directories and subdirectories

  9. 9

    How can I create a table with names of directories and subdirectories in R?

  10. 10

    Bash script to create multiple directories and Subdirectories

  11. 11

    Python: List directories/sub-directories with file names

  12. 12

    Bash script to create multiple directories and Subdirectories

  13. 13

    Linux: delete all directories with only one file and no subdirectories

  14. 14

    How to copy a list files to a list of directories or subdirectories

  15. 15

    How to list only filenames removing directories and subdirectories

  16. 16

    List files in subdirectories but don't list directories

  17. 17

    bash grep file directories

  18. 18

    Powershell script for comparing two directories based on file names only

  19. 19

    How can I list all files, but only in directories that have no subdirectories?

  20. 20

    Shell script to create directories and files from a list of file names

  21. 21

    BASH find file names but skip a list of file names

  22. 22

    Writing List<String> of Directories with Subdirectories

  23. 23

    Rename file names in multiple directories

  24. 24

    Loop through directories and subdirectories in bash

  25. 25

    How to find only directories without subdirectories?

  26. 26

    bash list all directories, subdirectories, folders, subfolders in then output to a separate file

  27. 27

    List file names in order of file size in BASH

  28. 28

    How to run a bash script only on directories that have no subdirectories

  29. 29

    Copy all files from subdirectories and subsubdirectories to main directory with modifying file names by adding prefix of all parent directories

HotTag

Archive