VOGONS

Common searches


First post, by BEEN_Nath_58

User metadata
Rank Oldbie
Rank
Oldbie

On my PC, I want to index the names of files and folders in a particular location (say the files or folders at "D:\Backups\"), to a text file or any format. Which application should help me do it? I don't have any the name of a program which does this, or is there a Windows function for it?

previously known as Discrete_BOB_058

Reply 2 of 7, by spiroyster

User metadata
Rank Oldbie
Rank
Oldbie

You can use dir command and pipe the output to a file.
Open command prompt, navigate to any dir, then type...

dir /b /s > filelist.txt

To get a list of all files, dirs and subdirs (and files) in a text file called filelist.txt.

See https://docs.microsoft.com/en-us/windows-serv … ws-commands/dir dir command docs for other switches such as file attributes etc. if you want to list that information too. Should even work in pre windows msdos (6.22 etc).

Reply 3 of 7, by BEEN_Nath_58

User metadata
Rank Oldbie
Rank
Oldbie
Boohyaka wrote on 2022-01-09, 10:03:

A simple PowerShell script will do what you want, for example:

get-childitem -path "d:\backups" -recurse | select-object FullName | export-csv "d:\index.csv"

spiroyster wrote on 2022-01-09, 10:53:
You can use dir command and pipe the output to a file. Open command prompt, navigate to any dir, then type... […]
Show full quote

You can use dir command and pipe the output to a file.
Open command prompt, navigate to any dir, then type...

dir /b /s > filelist.txt

To get a list of all files, dirs and subdirs (and files) in a text file called filelist.txt.

See https://docs.microsoft.com/en-us/windows-serv … ws-commands/dir dir command docs for other switches such as file attributes etc. if you want to list that information too. Should even work in pre windows msdos (6.22 etc).

Either of them worked fine, thanks. But is there a way, I can remove the full path and keep the file and folder's indexing.
For eg: I want "Folder X\xyz.txt" instead of "D:\Backups\Folder X\xyz.txt"

previously known as Discrete_BOB_058

Reply 4 of 7, by spiroyster

User metadata
Rank Oldbie
Rank
Oldbie

For powershell you can use the relative path parameter

Resolve-Path -Relative

Not possible for doing this with a dir command afaik, so you would need to write a batch script which removes that portion of the filepath from your results to make it relative.

Reply 5 of 7, by Hoping

User metadata
Rank Member
Rank
Member

For any topic that has to do with cataloging files of any kind, I use "Cathy" , it's free, you can find it on this page.
http://rva.mtg.sk/
The last use I have given it was to catalog the hard drives of my NAS computers, I have three, and I don't feel like having them on all day, so if I need something, with the search function of this program I know what computer it is on and on which hard drive.
At work, we use it to catalog the hard drives with the backup images of the customer's computers, easier than searching among a lot of hard drives one by one for the image for the specific computer of a specific customer.
You could try if it works for you.

Reply 6 of 7, by Errius

User metadata
Rank l33t
Rank
l33t

Is there a 64-bit version of EDLIN? In the old days you would use that to automatically edit text files by piping commands to it. There were fancy search-and-replace batch files that used it to do things like this. All this old knowledge has been lost.

ETA: I made a similar batch file many years ago. This is the important bit:

echo SCANNING DRIVE %1:
pushd %1:%movdir%
if %errorlevel%==1 goto ERROR
dir /s /b %mfiles% >> "%outf%\%outptmp%"
brep /c "%outf%\%outptmp%" "%1:\%movdir%" "\%movdir%" > NUL
if %errorlevel%==1 goto ERROR
type "%outf%\%outptmp%" >> "%outf%\%outp%"
if %errorlevel%==1 goto ERROR
popd
ECHO DONE
goto DONE

brep.exe is a third party program that does this. Here it removes the "C:" drive name from the list of file paths. I don't know if there's a way of doing this using just DOS tools.

ETA2: DEBUG is another tool that is missing from modern Windows. (Does Windows 10 32-bit have it?) Again, in the old days you could use this for simple automatic editing of binary files from within batch files by piping commands to it.

Last edited by Errius on 2022-01-24, 21:17. Edited 2 times in total.

“I like to dissect PCs. Don't you know I'm utterly insane?"

Reply 7 of 7, by Anders-

User metadata
Rank Member
Rank
Member
Errius wrote on Yesterday, 21:11:

Is there a 64-bit version of EDLIN? In the old days you would use that to automatically edit text files by piping commands to it. There were fancy search-and-replace batch files that used it to do things like this. All this old knowledge has been lost.

Replaced by edit... can't imagine the reasoning behind that decision.

Edit: yes, I can, but I don't agree 😁 Both are needed, imo.

Måttfull och balanserad.