目录中的所有文件第preadsheet [英] spreadsheet of all files in a directory
问题描述
我们正在最后确定一个法律问题,并需要提供所有的信件针对此事的列表。
我有一个文件夹,我的电脑上的所有电子邮件,Word文档,PDF文件,JPG文件等,并希望快速创建A S preadsheet列出文件名称,类型,大小,数据创建的。
We are finalising a legal matter and need to provide a list of all correspondence for the matter. I've got a folder on my computer with ALL of the emails, word docs, pdf's, jpg's etc. and wish to quickly create a spreadsheet listing the file name, type, size, data created.
这能有一个批处理文件做了什么?如果是这样,怎么样?
Can this be done with a batch file? If so, how?
推荐答案
这是一个基本的版本,应该让你去。
This is a basic version that should get you going.
它使用为
来收集有关文件夹中的文件(及所有子文件夹)的信息,输出为csv。
It uses for
to collect info about files in a folder (and all subfolders), outputting as csv.
您可以调整(或调整寻求帮助),如做pretty名的文件类型。此批给你的时间戳记是修改日期而非创建日期。如果这是至关重要的,我们可以解决这一点。
You could adjust (or ask for help in adjusting), such as making pretty names for the file type. The timestamp this batch gives you is 'date modified' rather than 'date created'. If that's critical we can work around that too.
@echo off
setlocal
set DATA_DIR=%1
if not defined DATA_DIR (
echo You must specify a folder with your data files.
exit /b 1
)
echo FILE, TYPE, SIZE, TIMESTAMP
for /f "delims=" %%f in ('dir /s /b /a-d %DATA_DIR%') do (
echo %%~f, %%~xf, %%~zf, %%~tf
)
要使用:
C:\...\> make_csv.cmd c:\data > FileList.csv
,你会得到类似FileList.csv:
And you will get something like FileList.csv:
FILE, TYPE, SIZE, TIMESTAMP
C:\data\that one.doc, .doc, 0, 10/05/2013 11:14 AM
C:\data\this one.txt, .txt, 6, 10/05/2013 11:14 AM
C:\data\sub\another.jpg, .jpg, 6, 10/05/2013 11:15 AM
这篇关于目录中的所有文件第preadsheet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!