Goal: Output .txt file with the full directory path, including name, of all .html files except for those with "txt" or "text" in the .html file name.
I found the following line gives me the desired .txt file with the file's full directory path. The only problem is that it gives me ALL of the folder's contents:
ls -d "$PWD"/* > fileList.txt
Example Results:
/Users/username/Desktop/WebsiteFiles/notes.txt
/Users/username/Desktop/WebsiteFiles/index.html
/Users/username/Desktop/WebsiteFiles/index-TEXT.html
/Users/username/Desktop/WebsiteFiles/answers.html
/Users/username/Desktop/WebsiteFiles/answers_txt.html
/Users/username/Desktop/WebsiteFiles/image.jpg
/Users/username/Desktop/WebsiteFiles/image2.jpg
/Users/username/Desktop/WebsiteFiles/about.html
/Users/username/Desktop/WebsiteFiles/about_TXT.html
/Users/username/Desktop/WebsiteFiles/contact.html
/Users/username/Desktop/WebsiteFiles/contact_text.html
/Users/username/Desktop/WebsiteFiles/images
Desired Results:
/Users/username/Desktop/WebsiteFiles/index.html
/Users/username/Desktop/WebsiteFiles/answers.html
/Users/username/Desktop/WebsiteFiles/about.html
/Users/username/Desktop/WebsiteFiles/contact.html
Experimenting:
I'm fairly new to using the command line. I've been experimenting trying to figure this stuff out. I found that the following find helps find all .html files:
find . -iname '*.html'
When used on the parent directory it will give me all .html files but not the full directory path, example result:
./index.html
./index-TEXT.html
./answers.html
./answers_txt.html
./about.html
./about_TXT.html
./contact.html
./contact_text.html
I'm not familiar enough with the parameters or assembling these commands and haven't been successful in getting a print of just the .html files without the ones with any of the variation of "text" in the name.
I have a ton of files to find with this and need that .txt file with the full paths. I want to understand this stuff so please provide detailed responses!