Shoutbox

Need a program to scan and save all names of files in a certain folder - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: Need a program to scan and save all names of files in a certain folder (/showthread.php?tid=77514)

Need a program to scan and save all names of files in a certain folder by Jimbo on 09-15-2007 at 10:06 PM

I am looking for a program that scans through a certain folder, and saves all of the files names (without file extension) into a text document? anyone know of anything like this?


RE: Need a program to scan and save all names of files in a certain folder by ddunk on 09-15-2007 at 10:17 PM

Winkey + R
cmd
cd <folder>
dir /b > C:\Output.txt

Includes file extentions, but those are simple enough to remove


RE: Need a program to scan and save all names of files in a certain folder by Jimbo on 09-16-2007 at 02:34 PM

quote:
Originally posted by ddunk
Winkey + R
cmd
cd <folder>
dir /b > C:\Output.txt

Includes file extentions, but those are simple enough to remove
Any way to do it without file extensions because i want to do this for like 300 files

EDIT: and when i try and do that, i get: access is denied, even though i am the only admin on this computer
RE: Need a program to scan and save all names of files in a certain folder by Mike on 09-16-2007 at 05:01 PM

If you are using vista, save to the C:\Users\YourUserName location or run cmd as an administrator.


RE: RE: Need a program to scan and save all names of files in a certain folder by Verte on 09-16-2007 at 05:55 PM

quote:
Originally posted by Jimbodude
Any way to do it without file extensions because i want to do this for like 300 files


There is probably an easier way using some kind of posix features, but I'm not that smart. So, here's some Python.

import os
output = open("output.txt",'a')
filenames = os.listdir("C:\\directory\\you\\want\\to\\list\\")
for file in filenames:
    output.write(file.split(".")[0] + "\r\n")
output.close()

just a first order approximation of course, I mean, this is not going to be that grand for files with more than one period in them. But, it will do for a measly 300 files.
RE: Need a program to scan and save all names of files in a certain folder by Jimbo on 09-16-2007 at 06:57 PM

Thanks guys, also, once ive removed the extensions, i get some duplicate files, anyone know whow to automatically delete these duplicates??
EDIT: cant see to get that python code to work, so any other ways od doing it?
Or if anyone feels up to it, they can edit the attachment and delete the file extenions and duplicates


RE: Need a program to scan and save all names of files in a certain folder by WDZ on 09-16-2007 at 11:16 PM

Here, file extensions and duplicates removed. :p

Note: Some of the files had more than one extension, but I only removed the last one.


RE: Need a program to scan and save all names of files in a certain folder by Jimbo on 09-17-2007 at 06:02 AM

Yay thanks WDZ :)