Windows Copy All Folder Names Without Copying Files

Sometimes we need to copy folder names only. In this tutorial, I’m going to share an idea to copy all folder names only without copying files. I’ve faced this issue and found a simple solution.

The Solution

Open command prompt (Windows+R, then type ‘cmd’ and hit enter) and navigate to the drive or directory. I’m going to copy all folder names from a directory (project) which is located in my D drive.

cd /d D:\project

Now, I’m in the project folder. In this directory, there are some files too. I want to take the folder names only. To do this, let’s run this command:

ls -d */ | cut -f1 -d'/'

Now we need to copy the names from the console.

If you want to display all folder and file names line by line, you can use this command:

ls -a | sort

Thank you. ?