1

I am trying to create a .txt file that is the output of a certain function in the terminal.

So my function is to create a list of all the files that i have inside the folder TEST so what i typed was:

chmod +x /Users/XXXX/Downloads/Terminal.sh
find /Users/XXXX/Downloads/Test -not -path '*/.*' >/Users/XXXX/Downloads/TestFiles.txt`

so this will create a file named TestFiles.txt, which will contain a list of all my folders and files inside the folder DOWNLOADS. its works perfectly fine for me

so my question is…. is there a way to add the size of each file right next to its name on the list in the .txt file?

Thank you

2

Try this:

find ~/Downloads/Test -name '*' -exec ls -la -print > ./files.txt {} \;

~/ is equal to: /Users/XXXX

The file "files.txt" is saved in the directory that you run this command.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .