copying file names in a text file

By Ramy, 13 July, 2023

Forum
macOS and Mac Apps

Hello all:

while working on mac, need to copy some file names inside a folder to a text file to send them to a friend,
so, how can i do this?
is there a command or something?
thanks in advance

Options

Comments

By Manuel on Tuesday, July 25, 2023 - 20:19

Hi, You could use the ls command and output the printed file names to a new text file. This works as follows:

  • Open Terminal (Located in Finder > Applications > Utilities)
  • navigate to the path where the files are located. use the cd command for this. If the files are in the documents folder, for example, you would enter the following: cd ~/documents. Normally, the shell should start at your home folder, ~/. You can also print the current working directory with the pwd command.
  • If you are in the right directory, type: ls > filenames.txt

Now the file names can be found in the folder where you performed the ls command in the created filenames.txt file.

If you have further questions, let me know.

By Ramy on Tuesday, July 25, 2023 - 20:19

WOw, will gonna try it now, but if i do not know the exact bath for the folder? or it is on google drive or something, what can i do in this case?

By Manuel on Tuesday, July 25, 2023 - 20:19

Google drive and other cloud platforms must usually use the FileProvider API of macOS. The sync root is then located at ~/library/CloudStorage. Normally, the cloud storage should also be available as alias in your home directory. for example, when I'm in my home folder, I can easily type cd OneDrive in order to navigate to the OneDrive directory.