DOS command to display all files on drive C whose filenames begin with the letter G and whose extensions begin with the letter D
DOS command to rename all the files on drive A which have the .HTML filename extension to have the .HTM filename extension.
DOS Command Help
Moderator: DosItHelp
Re: DOS Command Help
Just a quick hint. For the first question, have a look at the documentation of the where command. For the second have a look at the documentation of for /r.
https://ss64.com/nt/where.html
https://ss64.com/nt/for_r.html
https://ss64.com/nt/where.html
https://ss64.com/nt/for_r.html
Re: DOS Command Help
Hi,
remenber * character ( multiple returns , lambda sign ), It's from "Dos" sure.
dir *.* ==> all files and folders ( in current folder only )
dir *. ==> folders ( in current folder only )
playing with "location of the * "
I look for files with AM in name , and so AN in extension :
dir *AM*.*AN* ( it's the syntax for my search in the current folder ).
* is 0, or more characters, it's an undefined number of character(s).
EXTENSIONs are more than 3 letters now , so "dir *.AM*IN" can have positive feedbacks, the console show by default 3 chars as extensions ( good to know ).
=====================================================
How to crawl all my C partition and search in ?
dir /s *.* ==> will display all visible files in your C: , one folder after the other.
It's /s for "sub" directory", so a recursive search is executed from the current folder ( from Windows 95/98 ) and through the sub directories of your current folder.
with Dos commands :
use HELP or /? to have details about the command you want to execute.
It's helpful
=====================================================
for your needs :
dir /s c:\G*.D*
for the "big" rename , through a loop but it's composite use of rename and so "a list" of the target you need.
It's risky, because of faulty through a full disk
try : rename *.HTML *.HTM ( this one is ok ; in one folder )
but ensure you're in the "only good folders"
the prototype is rename [path:filename_from] [path:filename_to] with the full path it's avoiding errors and random renaming.
Bye.
remenber * character ( multiple returns , lambda sign ), It's from "Dos" sure.
dir *.* ==> all files and folders ( in current folder only )
dir *. ==> folders ( in current folder only )
playing with "location of the * "
I look for files with AM in name , and so AN in extension :
dir *AM*.*AN* ( it's the syntax for my search in the current folder ).
* is 0, or more characters, it's an undefined number of character(s).
EXTENSIONs are more than 3 letters now , so "dir *.AM*IN" can have positive feedbacks, the console show by default 3 chars as extensions ( good to know ).
=====================================================
How to crawl all my C partition and search in ?
dir /s *.* ==> will display all visible files in your C: , one folder after the other.
It's /s for "sub" directory", so a recursive search is executed from the current folder ( from Windows 95/98 ) and through the sub directories of your current folder.
with Dos commands :
use HELP or /? to have details about the command you want to execute.
It's helpful
=====================================================
for your needs :
dir /s c:\G*.D*
for the "big" rename , through a loop but it's composite use of rename and so "a list" of the target you need.
It's risky, because of faulty through a full disk
try : rename *.HTML *.HTM ( this one is ok ; in one folder )
but ensure you're in the "only good folders"
the prototype is rename [path:filename_from] [path:filename_to] with the full path it's avoiding errors and random renaming.
Bye.
Re: DOS Command Help
ok, so firstly, is this really DOS? or Windows cmd?
anyway, to list the files in current directory:
add /s if you want run through subdirectories as well.
on the rename of html files, That will really depend on more information. a simply rename *.html *.htm will rename files in the specific dir fine, but there might be particular files you do not want to rename. Is there a relationship between listing the files starting with D and G and the html file rename?
anyway, to list the files in current directory:
Code: Select all
dir /b /a-d G* D*
on the rename of html files, That will really depend on more information. a simply rename *.html *.htm will rename files in the specific dir fine, but there might be particular files you do not want to rename. Is there a relationship between listing the files starting with D and G and the html file rename?
Re: DOS Command Help
This is another way to list all "files on drive C whose filenames begin with the letter G and whose extensions begin with the letter D:"
Code: Select all
where /r C:\ G*.D*
Re: DOS Command Help
It's DOS 'disk operating system'.
It's a root of your Windows, a real WIndows resource too.
It's Microsoft when GUI was not written at that time ( ( year 1980' ??? ).
It's both really.
About WHERE and DIR , I note ( while reading SS64 ), that dir will execute a "binary search" while crawling, opposite to where making a less accurate ( or wider ) search,
so using where, if you look for "myfile.txt" , the research will return "myfile.bat" ; "myfale.txt" and so an so , It's a research "by string" and schemas of strings.
it could be great when approximate search , or large extended search required.
It's "hard search" [binary base] or "soft search" [strings base and schemas].
Re: DOS Command Help
I cannot say without confirmation, but I sincerely doubt the OP is using the command.com command line interpreter for MS-DOS (or other versions of DOS) or Windows versions up to Me. The command line interpreter for Windows NT systems is cmd.exe, which is very different. Also, the OP's question was about a large extended search.Gwarn_ wrote: ↑03 Nov 2021 01:31It's DOS 'disk operating system'.
It's a root of your Windows, a real WIndows resource too.
It's Microsoft when GUI was not written at that time ( ( year 1980' ??? ).
It's both really.
It's a research "by string" and schemas of strings.
it could be great when approximate search , or large extended search required.
It's "hard search" [binary base] or "soft search" [strings base and schemas].