Automation Techs For Productivity And Fun

Listing Up Files Under Folder Easily On Windows


There's always a work to make list of file names and saving them to Excel files.

If you are a Windows user and  if you know how to use "dir" command and "tree" command, this work would finish in a minute.

You can run these commands using command prompt.

https://www.lifewire.com/how-to-open-command-prompt-2618089

"dir" command - output files directly under folder

"dir" command is a command to output list of files directory under specified folder.

For example, if you want to write out files in "C:\Users\test" folder to a csv file like "C:\Users\test\Desktop\myfiles.csv", run the "dir" command like below.

dir /B C:\Users\test > C:\Users\test\Desktop\myfiles.csv

After running this command, open myfiles.csv and you'll see a list of files in it.

The command format means list this.

dir /B TARGET_FOLDER_PATH > FILE_PATH_TO_OUTPUT

"/B" is a command option to output only file names.

"tree" command - output files and folders recursively

"tree" command to output every file and folder under specified folder recursively.

If you want to write output the file tree under "C:\Users\test\docs" folder to a csv file "C:\Users\test\Desktop\myfiletree.csv", run the "tree" command like below.


tree /F C:\Users\test\docs > C:\Users\test\Desktop\myfiletree.csv

The command format means list this.

tree /F TARGET_ROOT_FOLDER_PATH > FILE_PATH_TO_OUTPUT

"/F" is a command option to write out both folder names and file names. Tree command outputs only folder names when ran without this option.

for more commands...

These two command are very basic commands you can use on command prompt.

If you want to learn more, check out the command list by Microsoft.

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands

Share:

Search This Blog

Labels

Generate Data For Testing With PostgreSQL

When developing a software using PostgreSQL database as storage, the function "generated_series" is very useful to create data ...

Powered by Blogger.

Labels

Recent Posts