DJI Mavic, Air and Mini Drones
Friendly, Helpful & Knowledgeable Community
Join Us Now

Searching for flight log csv's, via a windows command line

Yorkshire_Pud

Well-Known Member
Joined
Feb 24, 2022
Messages
4,907
Reactions
4,416
Age
63
Location
UK
I have ended up with multiplicated csv's of flight logs, i.e. beyond duplicated :eek: ( which I desire ), bearing in mind I have coming up on 4000 original csv's that's a lot of excessive 'triplication' or more and wasted disc space.
I can get part way to what I want with
dir /B /S *.csv > csv_list.csv.
That searches the current folder and all subfolders for any .csv and writes the output to the file "csv_list.csv" in the current folder but it results in an output that, for each csv, resembles

folder_1\folder_2\folder_3\folder_4\folder_5\folder_6\file_1.csv

For the next csv file, the output might be

folder_21\folder_22\folder_23\file_2.csv
obviously it depends on the path to the csv

I would like an output that looks like
folder_1\folder_2\folder_3\folder_4\folder_5\folder_6\ file_1.csv file#1's_size
folder_21\folder_22\folder_23\ file_2.csv file#2's_size

Working on "csv_list .csv", separating the actual 'file name' off the 'folder list/path' is complicated due to the names of some of the folders, plus, I don't end up with the sizes of the various csv's.

Does anyone know a way, with "dir" or some other command-line command, to get the output I seek?
I'd like the size to be included but will settle for just the path and separate file name.
Thanks.
 
Last edited:
Well I used "find" in Linux to find the csv's and output their details to a csv, in the style of "a)" above BUT WITH size info included.
Then used Windws and Excel to replace the last instance of the folder separator with something suitable.
Where the Path/file_name.csv were in column J and the folder separtors were "\"s the following swaps the last "\" for a "/".

=SUBSTITUTE(J142,"/","\",LEN(J142)-LEN(SUBSTITUTE(J142,"/","")))

Don't ask me how it works lol I haven't a clue. 😁

Then used "text to column" to split column J at "/"
 
Does anyone know a way, with "dir" or some other command-line command, to get the output I seek?
I'd like the size to be included but will settle for just the path and separate file name.
A pure PowerShell solution would be:

Get-ChildItem -Recurse | Select-Object -Property FullName, Length