Skip to Main Content



File Management

Tips for managing digital files by the Iowa State University Library

File lists

Uses

When organizing and maintaining existing files, it often is useful to generate a list of all files in your shared directories. Possible uses include:

  • Reviewing file and folder names to determine whether file-naming conventions are being followed.
  • Determining which files may be archived or deleted.
  • Creating an inventory for reporting purposes.

Shell command overview

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.

File list commands


File list quick reference

 

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
Shell

Get-ChildItem -Recurse Get-ChildItem Get-ChildItem -Recurse -Name Get-ChildItem -Name

Command Prompt

dir /S dir dir /B /S dir /B

Instructions

Use these links to view instructions for the following shells. Also consult the Command line quick start page if needed.


Mac Terminal

  1. In Terminal, navigate to the top-level directory (folder) you want to view.
  2. On the command line, type or paste one of these commands:
  • Output results in the shell window: ls -Rl
  • Output results in a TXT file (saved in the top-level directory): 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.


Windows PowerShell

  1. In PowerShell, navigate to the top-level directory (folder) you want to view.
  2. On the command line, type or paste one of these commands:
  • Output results in the shell window: Get-ChildItem -Recurse
  • Output results in a TXT file (saved in the top-level directory): 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.


Windows Command Prompt

  1. In Command Prompt, navigate to the top-level directory (folder) you want to view.
  2. On the command line, type or paste one of these commands:
  • Output results in the shell window: dir /S
  • Output results in a TXT file (saved in the top-level directory): 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.

 

Contact information

Questions? Contact us!

Consultations are also available by request.

Megan O'Donnell, Research Data Services Lead

datashare@iastate.edu

Heather Campbell, Head of Metadata Services

metadata@iastate.edu

File Management by Heather Campbell and Megan O'Donnell is licensed under CC BY 4.0 Attribution