Previously I have asked a very similar question but it was only for one subdirectory writing files in a subdirectory to a csv file and save it to parent directory in linux command line. I have a directory called 'dir', and there are 5 subdirectories in it, sub1, sub2,..sub5. Each sub directory has many files in it. I would like write to list of files from all subdirectories to a CSV file and save it to in 'dir' directory with a command line on linux. My code does that except I only want the filenames (name1,name2 etc) but it writes the full filenames with path (./sub1/name1,./sub1/name2, etc ). The command line I am using inside the dir folder is;
dir$ find . -type f > names.csv