0

I have a file structure with name date format. I need a command that travels directory by directory and shows the files but without showing the directory in order to save them in a variable.

I've tried with find. -type d, but it shows me the directories.

Thanks for the help.

1 Answers1

2

You can use:

find . -not -type d

Example:

$ tree
.
├── test1
│   ├── A
│   ├── B
│   └── C
└── test2
    ├── D
    └── E

2 directories, 5 files

$ find .                                       
.
./test2
./test2/D
./test2/E
./test1
./test1/A
./test1/B
./test1/C

$ find . -not -type d
./test2/D
./test2/E
./test1/A
./test1/B
./test1/C
Szczerba
  • 271
  • 1
  • 8
  • Though probably the OP is specifically looking for `-type f` which lists only files (and also skips e.g. symbolic links and device files). – tripleee Aug 22 '18 at 06:33
  • Sorry, i use -type f, because this command return: /transactions/mar@alojamientosaran.com/HotelAvailPriceNotifRQ/2018-09-02_TRANSACTION_36044ad2eec032fe.json i only need select the last file – Ruben Serena Tellechea Aug 22 '18 at 07:13