标题: [文件操作] [已解决]批处理怎样实现文件属性以及文件修改或删除? [打印本页]
作者: lxh623 时间: 2011-11-16 13:21 标题: [已解决]批处理怎样实现文件属性以及文件修改或删除?
本帖最后由 lxh623 于 2011-11-16 22:37 编辑
E盘发现部分文件有问题,右键没有“剪切、复制、删除、重命名”,包括pdf和txt两种类型。
我查了相关“属性”的批处理,用下面的代码(感谢超级版主,我修改了原始代码。)获得了这些文件,然而我并不懂得为什么仅仅出来这些文件。
真的不知道为什么造成这些文件,会不会批处理移动等操作造成?我检查文件名好像不含有非法字符。
(如果给我上面两项的解释,我非常非常感谢!)
我想,请求您帮我在此基础上,创建批处理,查到这些文件,修复到正常是最好的办法。
第二个办法是,查到这些文件,提取文件名到文本a,然后删除该文件。(手工无法删除!!)
第三个办法,我在E盘根目录运行下面代码得到文件名,怎样根据文件名删除原文件。(文件名^到-,比如,文本attrib1修改为JP56032149等,查找JP56032149开始的文件,txt或者pdf,然后删除。)
我想在E盘一次进行大检查。
在此首先感谢您无私的帮助!
运行批处理得到的结果:- attrib ~1,4 "E:\应用-电子电力\办公设备\toner+developer\electrophotographic carrier(carrier electrostatic)\JP56032149-electrostatic image developing carrier particles prodn - by coating core with silane resin contg peroxy gps and then heating, has triboelectric and mechanical properties.pdf"
- attrib ~1,4 "E:\应用-电子电力\办公设备\toner+developer\developer\静電荷像現像用電荷付与材charg developer(toner,developing)\US5206107-=high resolution liq electrostatic developer having good print reproducibility - includes liq dispersion medium and marking particles with post added siloxane-alkylene oxide block copolym-Xerox.pdf"
- attrib ~1,4 "E:\应用-电子电力\办公设备\toner+developer\二成分系現像剤two component developer(toner,developing)\JP8248670-=one component developer for electrostatic copying machine - comprises toner granule contg binder resin, colourant and external additive consisting of modified hydrophobic anatase titanium oxide and .txt"
- attrib ~1,4 "E:\应用-电子电力\办公设备\toner+developer\二成分系現像剤two component developer(toner,developing)\DE10064584-=toner or colored toner containing dye and/or colored pigment, especially for digital printer or copier, contains component undergoing exothermic reaction when irradiated or heated.txt"
- attrib ~1,4 "E:\应用-电子电力\办公设备\toner+developer\二成分系現像剤two component developer(toner,developing)\JP62005256-=development using one-component non-magnetic toner - comprises applying toner to surface of toner holding body and transferring to image retaining body to form visible electrostatic images-GET.txt"
- attrib ~1,4 "E:\应用-电子电力\办公设备\toner+developer\二成分系現像剤two component developer(toner,developing)\US5714299-=process for preparation of toner additives having metal or oxide core - by heating liquid carbon dioxide, metal or oxide and organo-silane surface treating component at specific temperature and remo.txt"
- attrib ~1,4 "E:\应用-电子电力\办公设备\toner+developer\二成分系現像剤two component developer(toner,developing)\US6203960-=toner composition for electrophotographic imaging comprises binder, colorant and toner particle surface additive component containing fumed silica coated with alkylsilane and aminoalkylsilane.txt"
复制代码
- @echo off
- :: 获取某个文件夹下所有子文件夹及其文件的属性
- :: Code by JM 2006-9-13 Thanks pengfei
- rem ========获取文件(夹)的属性=============
- cd.>attrib.txt
- setlocal enabledelayedexpansion
- for /f "tokens=*" %%i in ('dir /b /s /a-d /a-h') do (
- set attrib_=%%~ai
- set attrib_=!attrib_:~1,4!
- set attrib_=!attrib_:h=+h !
- set attrib_=!attrib_:r=+r !
- set attrib_=!attrib_:s=+s !
- set attrib_=!attrib_:a=!
- set attrib_=!attrib_:-=!
- if not "!attrib_!"=="" echo attrib !attrib_! "%%i">>attrib1.txt
- )
复制代码
作者: canyuexiaolang 时间: 2011-11-16 13:36
你给改坏了啊....attrib ~1,4都出来了..
我运行是这样的
attrib +s "C:\Documents and Settings\Administrator\桌面\VB"
attrib +s "C:\Documents and Settings\Administrator\桌面\VC"
..........
作者: lxh623 时间: 2011-11-16 22:38
本帖最后由 lxh623 于 2011-11-16 23:12 编辑
自己解决了。用批处理搜索,只有39个。手动处理了。
继续发现,可能文件夹名称太长引起。原来以为,文件名称必须少于250,今天猜测是不是连同路径的合并长度也有要求。
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |