naqayya
asked on
List file names in Excel
I have a folder that stores images (jgs, tif, etc.) of forms that have been scanned. Each form is related to ONE of our customers, so we have named each image file as the CustomerID.
For example I have some files named:
34568.jpg
146.tif
267897.jpg
7654.tif
679839.tif
...
I need to create an excel file (or text file) with a list of all the IDs of the file names that have been stored. So, for the above I need an excel file that has entries:
34568
146
267897
7654
679839
Is there any way of doing this? Thanks.
For example I have some files named:
34568.jpg
146.tif
267897.jpg
7654.tif
679839.tif
...
I need to create an excel file (or text file) with a list of all the IDs of the file names that have been stored. So, for the above I need an excel file that has entries:
34568
146
267897
7654
679839
Is there any way of doing this? Thanks.
ASKER
Thanks oBdA!
I am a bit of a novice here: do I enter this command from a command prompt on the PC and do I have to be in the directory that has the files?
Thanks.
I am a bit of a novice here: do I enter this command from a command prompt on the PC and do I have to be in the directory that has the files?
Thanks.
ASKER
How do I go to that directory in the command prompt? I need to get files from:
E:\GADs\0 - 50,000
(note the spaces and comma in the directory name)
Thanks!
E:\GADs\0 - 50,000
(note the spaces and comma in the directory name)
Thanks!
naqayya
If this is just a one off then you could just run the following from the command line (in the right directory!)
dir /b > output.txt
The file output.txt will contain your filenames which can be imported into Excel.
You can strip off the externsion in Excel by adding a formula into the next column over from your list that goes:
=MID(A1,1,LEN(A1)-4)
Where A1 is the first cell of your list.
Copy the formula down and use the new column as your start data
Cheers
JamesDS
If this is just a one off then you could just run the following from the command line (in the right directory!)
dir /b > output.txt
The file output.txt will contain your filenames which can be imported into Excel.
You can strip off the externsion in Excel by adding a formula into the next column over from your list that goes:
=MID(A1,1,LEN(A1)-4)
Where A1 is the first cell of your list.
Copy the formula down and use the new column as your start data
Cheers
JamesDS
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks all
for %a in (*.*) do @echo %~na >>"S:\ome\Directory\id.txt
which will create the file "id.txt" (delete the file if it exists before issuing in a command).
That can of course be put into a batch file as well:
@echo off
set OutFile=S:\ome\Directory\i
if exist "%OutFile%" del "%OutFile%"
for %%a in (*.*) do echo %%~na >>"%OutFile%"
For additional goodies, you need to provide more information...