When organizing and maintaining existing files, it often is useful to generate a list of all files in your shared directories. Possible uses include:
You can use shell commands to generate file lists that include such information as name, location, size, and date last modified.
Note: Before using shell commands, you should be familiar with viewing files in File Explorer (Windows) or Finder (Mac). If you are using a cloud-based storage application, such as Box, Google Drive, or Dropbox, you may need to install a free desktop application to access your files through File Explorer or Finder. Go to the application's website for details.
List file and folder details, including subfolder contents |
List top-level file and folder details |
List file and folder names, including subfolder contents |
List top-level file and folder names |
|
---|---|---|---|---|
Terminal |
ls -Rl |
ls -l |
ls -R |
ls |
Power |
Get-ChildItem -Recurse |
Get-ChildItem |
Get-ChildItem -Recurse -Name |
Get-ChildItem -Name |
Command Prompt |
dir /S |
dir |
dir /B /S |
dir /B |
Use these links to view instructions for the following applications:
ls -Rl
ls -Rl > filenames.txt
Note: -Rl
includes details about all subfolders and their contents in the list. ("R" means recursive.) If you want details about only the top-level folder contents in your list, use ls -l
. If you want file and folder names without file properties, use ls -R
or ls
.
cd
and the path name—for example, cd /Users/abc/Documents
Note: To get the path name, go to Finder and select the folder you want to view. Then choose one of these options:
For more information, see the Apple documentation.
Get-ChildItem -Recurse
Get-ChildItem -Recurse >> filenames.txt
Note: -Recurse
includes details about all subfolders and their contents in the list. If you want details about just the top-level folder contents in your list, use Get-ChildItem
only. If you want file and folder names without file properties, add -Name
after your command.
For more information, see the Microsoft documentation.
dir /S
dir /S > filenames.txt
Note: /S
includes all subfolders and their contents in the list. If you want only the top-level folder contents in your list, use dir
only.
cd
and the path name—for example, cd "C:\Users\abc\Documents"
Note: To get the path name, go to File Explorer and select the folder you want to view. Then choose one of these options:
Consultations are also available by request.
Megan O'Donnell, Research Data Services Lead
Heather Campbell, Head of Metadata Services