Windows CLI list requirement: dir /n/s list, but one line per file dir /b/s and with inline full path
up vote
0
down vote
favorite
I frequently use a batchscript dirlist.bat to generate a quick searchable text to find file information.
dirlist.bat
dir *.* /b/s >dirlist.txt
now I need additionally date and size information. As this would build a multicolumn list a csv-listoutput would be prefered.
This is my inspiration:
dir *.doc? /n/s >dirlist.txt
but I get a mixed multiline output. Filematches and folder summaries are intermingled.
Do you know a script approch to list the base information of each filematch into one line?
windows batch-file cmd scripting file-search
add a comment |
up vote
0
down vote
favorite
I frequently use a batchscript dirlist.bat to generate a quick searchable text to find file information.
dirlist.bat
dir *.* /b/s >dirlist.txt
now I need additionally date and size information. As this would build a multicolumn list a csv-listoutput would be prefered.
This is my inspiration:
dir *.doc? /n/s >dirlist.txt
but I get a mixed multiline output. Filematches and folder summaries are intermingled.
Do you know a script approch to list the base information of each filematch into one line?
windows batch-file cmd scripting file-search
2
You'd probably be better off using PowerShell rather than doing Unix-style text-mangling
– Hong Ooi
Nov 8 at 8:52
Can you be more specific, giving a code example?
– olippuner
Nov 8 at 8:57
Possible duplicate of Windows batch file to create csv list of file and dates
– LotPings
Nov 8 at 9:39
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I frequently use a batchscript dirlist.bat to generate a quick searchable text to find file information.
dirlist.bat
dir *.* /b/s >dirlist.txt
now I need additionally date and size information. As this would build a multicolumn list a csv-listoutput would be prefered.
This is my inspiration:
dir *.doc? /n/s >dirlist.txt
but I get a mixed multiline output. Filematches and folder summaries are intermingled.
Do you know a script approch to list the base information of each filematch into one line?
windows batch-file cmd scripting file-search
I frequently use a batchscript dirlist.bat to generate a quick searchable text to find file information.
dirlist.bat
dir *.* /b/s >dirlist.txt
now I need additionally date and size information. As this would build a multicolumn list a csv-listoutput would be prefered.
This is my inspiration:
dir *.doc? /n/s >dirlist.txt
but I get a mixed multiline output. Filematches and folder summaries are intermingled.
Do you know a script approch to list the base information of each filematch into one line?
windows batch-file cmd scripting file-search
windows batch-file cmd scripting file-search
edited 2 days ago
asked Nov 8 at 8:49
olippuner
18119
18119
2
You'd probably be better off using PowerShell rather than doing Unix-style text-mangling
– Hong Ooi
Nov 8 at 8:52
Can you be more specific, giving a code example?
– olippuner
Nov 8 at 8:57
Possible duplicate of Windows batch file to create csv list of file and dates
– LotPings
Nov 8 at 9:39
add a comment |
2
You'd probably be better off using PowerShell rather than doing Unix-style text-mangling
– Hong Ooi
Nov 8 at 8:52
Can you be more specific, giving a code example?
– olippuner
Nov 8 at 8:57
Possible duplicate of Windows batch file to create csv list of file and dates
– LotPings
Nov 8 at 9:39
2
2
You'd probably be better off using PowerShell rather than doing Unix-style text-mangling
– Hong Ooi
Nov 8 at 8:52
You'd probably be better off using PowerShell rather than doing Unix-style text-mangling
– Hong Ooi
Nov 8 at 8:52
Can you be more specific, giving a code example?
– olippuner
Nov 8 at 8:57
Can you be more specific, giving a code example?
– olippuner
Nov 8 at 8:57
Possible duplicate of Windows batch file to create csv list of file and dates
– LotPings
Nov 8 at 9:39
Possible duplicate of Windows batch file to create csv list of file and dates
– LotPings
Nov 8 at 9:39
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
You could probably use ForFiles
.
Example:
@(ForFiles /S /M *.* /C "Cmd /C Echo @File,@FDate,@FSize")>DirList.txt
Many thanks. This works like a charm. Here some slight modifications, using ";" as CSV-separator for my resident country: @(ForFiles /S /M . /C "Cmd /C Echo @FDate;@fsize;@file;@path;")>DirList.csv
– olippuner
2 days ago
mind using <fsize> instead of <size>
– olippuner
2 days ago
I hadn't noticed that my autocorrect had removed theF
, code corrected, thanks. I have not replaced the commas because the question is related to aCSV
, and guess what theC
stands for?
– Compo
2 days ago
add a comment |
up vote
1
down vote
Why not just run a loop and get the date and filesize with it?
for /f %i in ('dir /b/s *.doc?') do echo %~zti %~dpfi >>dirlist.txt
you can dump the dir
command and simply use the for /d
and /r
(recursive) search. See for /?
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
You could probably use ForFiles
.
Example:
@(ForFiles /S /M *.* /C "Cmd /C Echo @File,@FDate,@FSize")>DirList.txt
Many thanks. This works like a charm. Here some slight modifications, using ";" as CSV-separator for my resident country: @(ForFiles /S /M . /C "Cmd /C Echo @FDate;@fsize;@file;@path;")>DirList.csv
– olippuner
2 days ago
mind using <fsize> instead of <size>
– olippuner
2 days ago
I hadn't noticed that my autocorrect had removed theF
, code corrected, thanks. I have not replaced the commas because the question is related to aCSV
, and guess what theC
stands for?
– Compo
2 days ago
add a comment |
up vote
1
down vote
accepted
You could probably use ForFiles
.
Example:
@(ForFiles /S /M *.* /C "Cmd /C Echo @File,@FDate,@FSize")>DirList.txt
Many thanks. This works like a charm. Here some slight modifications, using ";" as CSV-separator for my resident country: @(ForFiles /S /M . /C "Cmd /C Echo @FDate;@fsize;@file;@path;")>DirList.csv
– olippuner
2 days ago
mind using <fsize> instead of <size>
– olippuner
2 days ago
I hadn't noticed that my autocorrect had removed theF
, code corrected, thanks. I have not replaced the commas because the question is related to aCSV
, and guess what theC
stands for?
– Compo
2 days ago
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
You could probably use ForFiles
.
Example:
@(ForFiles /S /M *.* /C "Cmd /C Echo @File,@FDate,@FSize")>DirList.txt
You could probably use ForFiles
.
Example:
@(ForFiles /S /M *.* /C "Cmd /C Echo @File,@FDate,@FSize")>DirList.txt
edited 2 days ago
answered Nov 8 at 13:53
Compo
15.1k3926
15.1k3926
Many thanks. This works like a charm. Here some slight modifications, using ";" as CSV-separator for my resident country: @(ForFiles /S /M . /C "Cmd /C Echo @FDate;@fsize;@file;@path;")>DirList.csv
– olippuner
2 days ago
mind using <fsize> instead of <size>
– olippuner
2 days ago
I hadn't noticed that my autocorrect had removed theF
, code corrected, thanks. I have not replaced the commas because the question is related to aCSV
, and guess what theC
stands for?
– Compo
2 days ago
add a comment |
Many thanks. This works like a charm. Here some slight modifications, using ";" as CSV-separator for my resident country: @(ForFiles /S /M . /C "Cmd /C Echo @FDate;@fsize;@file;@path;")>DirList.csv
– olippuner
2 days ago
mind using <fsize> instead of <size>
– olippuner
2 days ago
I hadn't noticed that my autocorrect had removed theF
, code corrected, thanks. I have not replaced the commas because the question is related to aCSV
, and guess what theC
stands for?
– Compo
2 days ago
Many thanks. This works like a charm. Here some slight modifications, using ";" as CSV-separator for my resident country: @(ForFiles /S /M . /C "Cmd /C Echo @FDate;@fsize;@file;@path;")>DirList.csv
– olippuner
2 days ago
Many thanks. This works like a charm. Here some slight modifications, using ";" as CSV-separator for my resident country: @(ForFiles /S /M . /C "Cmd /C Echo @FDate;@fsize;@file;@path;")>DirList.csv
– olippuner
2 days ago
mind using <fsize> instead of <size>
– olippuner
2 days ago
mind using <fsize> instead of <size>
– olippuner
2 days ago
I hadn't noticed that my autocorrect had removed the
F
, code corrected, thanks. I have not replaced the commas because the question is related to a CSV
, and guess what the C
stands for?– Compo
2 days ago
I hadn't noticed that my autocorrect had removed the
F
, code corrected, thanks. I have not replaced the commas because the question is related to a CSV
, and guess what the C
stands for?– Compo
2 days ago
add a comment |
up vote
1
down vote
Why not just run a loop and get the date and filesize with it?
for /f %i in ('dir /b/s *.doc?') do echo %~zti %~dpfi >>dirlist.txt
you can dump the dir
command and simply use the for /d
and /r
(recursive) search. See for /?
add a comment |
up vote
1
down vote
Why not just run a loop and get the date and filesize with it?
for /f %i in ('dir /b/s *.doc?') do echo %~zti %~dpfi >>dirlist.txt
you can dump the dir
command and simply use the for /d
and /r
(recursive) search. See for /?
add a comment |
up vote
1
down vote
up vote
1
down vote
Why not just run a loop and get the date and filesize with it?
for /f %i in ('dir /b/s *.doc?') do echo %~zti %~dpfi >>dirlist.txt
you can dump the dir
command and simply use the for /d
and /r
(recursive) search. See for /?
Why not just run a loop and get the date and filesize with it?
for /f %i in ('dir /b/s *.doc?') do echo %~zti %~dpfi >>dirlist.txt
you can dump the dir
command and simply use the for /d
and /r
(recursive) search. See for /?
edited Nov 8 at 14:24
answered Nov 8 at 12:54
Gerhard Barnard
6,44931030
6,44931030
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53204226%2fwindows-cli-list-requirement-dir-n-s-list-but-one-line-per-file-dir-b-s-and%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
2
You'd probably be better off using PowerShell rather than doing Unix-style text-mangling
– Hong Ooi
Nov 8 at 8:52
Can you be more specific, giving a code example?
– olippuner
Nov 8 at 8:57
Possible duplicate of Windows batch file to create csv list of file and dates
– LotPings
Nov 8 at 9:39