Windows Copy All Folder Names Without Copying Files

Last modified on December 18, 2019 31 sec read

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. 🙂

Monthly Newsletter

One email a month, packed with the latest tutorials, delivered straight to your inbox.
We'll never send any spam or promotional emails.

Hey, I'm Md Obydullah. I build open-source projects and write article on Laravel, Linux server, modern JavaScript and more on web development.