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.
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.
You also should be able to open a command-line shell at a certain directory. For instructions, see the Command line quick start page.
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 shells. Also consult the Command line quick start page if needed.
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
.
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.
Consultations are also available by request.
Megan O'Donnell, Research Data Services Lead
Heather Campbell, Head of Metadata Services