[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

[文件操作] [已解决]批处理怎样实现文件属性以及文件修改或删除?

本帖最后由 lxh623 于 2011-11-16 22:37 编辑

E盘发现部分文件有问题,右键没有“剪切、复制、删除、重命名”,包括pdf和txt两种类型。
我查了相关“属性”的批处理,用下面的代码(感谢超级版主,我修改了原始代码。)获得了这些文件,然而我并不懂得为什么仅仅出来这些文件。
真的不知道为什么造成这些文件,会不会批处理移动等操作造成?我检查文件名好像不含有非法字符。
(如果给我上面两项的解释,我非常非常感谢!)
我想,请求您帮我在此基础上,创建批处理,查到这些文件,修复到正常是最好的办法。
第二个办法是,查到这些文件,提取文件名到文本a,然后删除该文件。(手工无法删除!!)
第三个办法,我在E盘根目录运行下面代码得到文件名,怎样根据文件名删除原文件。(文件名^到-,比如,文本attrib1修改为JP56032149等,查找JP56032149开始的文件,txt或者pdf,然后删除。)

我想在E盘一次进行大检查。
在此首先感谢您无私的帮助!
运行批处理得到的结果:
  1. 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"
  2. 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"
  3. 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"
  4. 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"
  5. 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"
  6. 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"
  7. 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"
复制代码
  1. @echo off
  2. :: 获取某个文件夹下所有子文件夹及其文件的属性
  3. :: Code by JM 2006-9-13 Thanks pengfei
  4. rem  ========获取文件(夹)的属性=============
  5. cd.>attrib.txt
  6. setlocal enabledelayedexpansion
  7. for /f "tokens=*" %%i in ('dir /b /s /a-d /a-h') do (
  8.     set attrib_=%%~ai
  9.     set attrib_=!attrib_:~1,4!
  10.     set attrib_=!attrib_:h=+h !
  11.     set attrib_=!attrib_:r=+r !
  12.     set attrib_=!attrib_:s=+s !
  13.     set attrib_=!attrib_:a=!
  14.     set attrib_=!attrib_:-=!
  15.     if not "!attrib_!"=="" echo attrib !attrib_! "%%i">>attrib1.txt
  16. )
复制代码
1

评分人数

    • CrLf: 感谢给帖子标题标注[已解决]字样PB + 2

你给改坏了啊....attrib ~1,4都出来了..
我运行是这样的
attrib +s  "C:\Documents and Settings\Administrator\桌面\VB"
attrib +s  "C:\Documents and Settings\Administrator\桌面\VC"
..........
1

评分人数

    • CrLf: 乐于助人PB + 5

TOP

本帖最后由 lxh623 于 2011-11-16 23:12 编辑

自己解决了。用批处理搜索,只有39个。手动处理了。
继续发现,可能文件夹名称太长引起。原来以为,文件名称必须少于250,今天猜测是不是连同路径的合并长度也有要求。

TOP

返回列表