|
joshualaw
初级用户
 
积分 132
发帖 62
注册 2007-6-5
状态 离线
|
『楼 主』:
如何根据TAR文件的状态把文件分类?
使用 LLM 解释/回答一下
各位高手:
请帮我写一个能实现下列功能批处理。
1. 假设在 C:\log 文件夹有许多 .TAR 文件(已压缩的文件),而且每个.TAR文件只有一种状态,要么是 TP要么是 TF (你可从 .TAR 文件看出来)
2. 要把带有TP或TF的 .TAR文件区别开来,例如:把带有TF的 .TAR文件移到 C:\log\TF\文件夹里,
3.由于无法附上.TAR原文件,只有附上.TAR文件的内容在此给各位参照
************************************************************
SBS7152297IB
CWHP
BWHP UI
Nhuawhpfct11
PFVT
s0
D2217.scr
R???
nW10110641
rREL
OC900260
L29
p11
W???
06/01/07 20:13:36
TF
FWRCVP_Disable Heartbeat
>WIDE_RECEIVE_PACKET (Disable Heartbeat Broadcast packet)
>RcvPacket() returned an error
>Timeout getting packet byte
MWide_FW_Version
d0x11
************************************************************
Last edited by bjsh on 2007-7-31 at 02:28 PM ]
Dear experts:
Please help me write a batch processing that can implement the following functions.
1. Suppose there are many .TAR files in the C:\log folder (compressed files), and each .TAR file has only one state, either TP or TF (you can tell from the .TAR file)
2. To distinguish the .TAR files with TP or TF, for example: move the .TAR files with TF to the C:\log\TF\ folder,
3. Since the original .TAR file cannot be attached, only the content of the .TAR file is attached here for your reference
************************************************************
SBS7152297IB
CWHP
BWHP UI
Nhuawhpfct11
PFVT
s0
D2217.scr
R???
nW10110641
rREL
OC900260
L29
p11
W???
06/01/07 20:13:36
TF
FWRCVP_Disable Heartbeat
>WIDE_RECEIVE_PACKET (Disable Heartbeat Broadcast packet)
>RcvPacket() returned an error
>Timeout getting packet byte
MWide_FW_Version
d0x11
************************************************************
Last edited by bjsh on 2007-7-31 at 02:28 PM ]
此帖被 -2 点积分 点击查看详情 评分人:【 lxmxn 】 | 分数: -2 | 时间:2007-6-16 21:47 |
|
|
|
2007-6-13 22:23 |
|
|
wudixin96
银牌会员
    
积分 1928
发帖 931
注册 2007-1-6
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
楼主的意思是说,只要TAR文件中包含TF的就放入TF文件夹,TP的就放入TP文件夹?
Does the LZ mean that as long as the TAR file contains TF, it is put into the TF folder, and if it contains TP, it is put into the TP folder?
|
|
2007-6-13 22:39 |
|
|
joshualaw
初级用户
 
积分 132
发帖 62
注册 2007-6-5
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
是的,能做的到吗,谢谢您的及时回复
Yes, can it be done? Thank you for your timely reply
|
|
2007-6-13 22:46 |
|
|
wudixin96
银牌会员
    
积分 1928
发帖 931
注册 2007-1-6
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
对TAR文件一点不熟悉。只知道是Linux下的压缩文件。
楼主的文件内容是如何提取出来的?
是文件名称,还是只是文本内容?
I'm not familiar with TAR files at all. I only know they are compression files under Linux.
How was the content of the owner's file extracted?
Is it the file name or just the text content?
|
|
2007-6-13 23:13 |
|
|
joshualaw
初级用户
 
积分 132
发帖 62
注册 2007-6-5
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
先指着.TAR文件后右击鼠标选记事本打开的,外表看是一个压缩文件,其实内容是文本内容
First, point to the.TAR file, then right-click the mouse and select Notepad to open. It looks like a compressed file on the surface, but actually the content is text content
|
|
2007-6-13 23:26 |
|
|
wudixin96
银牌会员
    
积分 1928
发帖 931
注册 2007-1-6
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
这个可以参考一下。
@echo off&setlocal enabledelayedexpansion
if not exist TF md TF
if not exist TP md TP
for /f %%i in ('dir /b *.txt') do (
find /c "TF" %%i
if !errorlevel!==0 copy %%i TF\%%i&del /q /f %%i
)
copy *.txt TP\*.txt
del /q /f *.txt
偶假设当前文件夹下有许多文本文件,其中也只包含TF或TP字符。
This can be referred to.
@echo off&setlocal enabledelayedexpansion
if not exist TF md TF
if not exist TP md TP
for /f %%i in ('dir /b *.txt') do (
find /c "TF" %%i
if !errorlevel!==0 copy %%i TF\%%i&del /q /f %%i
)
copy *.txt TP\*.txt
del /q /f *.txt
I assume there are many text files in the current folder, and they only contain "TF" or "TP" characters.
|
|
2007-6-14 00:34 |
|
|
joshualaw
初级用户
 
积分 132
发帖 62
注册 2007-6-5
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
先谢谢高手,基本功能可以实现但还不能100%精确的把含有TP 或 TF 字符的.TAR文件区别开来,例如: 暂时发现下列两个文件名.TAR 文件,其内容是含有TP 的字符,但还是放在 TF的文件夹理,能否帮我再研究研究看,先谢了.
RE0724000R5CA(6-13-2007 16-3-38).TAR --->是文件名
KM107230000JLA(6-9-2007 12-41-29).TAR--->是文件名
First, thank you to the experts. The basic functions can be realized, but the.TAR files containing TP or TF characters cannot be accurately distinguished 100%. For example, the following two filenames of.TAR files are found temporarily. Their contents contain TP characters, but they are still placed in the folder with TF. Can you help me study it again? Thank you first.
RE0724000R5CA(6-13-2007 16-3-38).TAR ---> is the file name
KM107230000JLA(6-9-2007 12-41-29).TAR---> is the file name
|
|
2007-6-14 15:05 |
|
|
wudixin96
银牌会员
    
积分 1928
发帖 931
注册 2007-1-6
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
失误,忘问楼主的文件名是否含空格了。呵呵
类似的 @echo off&setlocal enabledelayedexpansion
if not exist TF md TF
if not exist TP md TP
for /f "delims=" %%i in ('dir /b *.txt') do (
find /c "TF" "%%i"
if !errorlevel!==0 copy "%%i" TF\"%%i"&del /q /f "%%i"
)
copy *.txt TP\*.txt
del /q /f *.txt
没测试,先看看吧。
Mistake, forgot to ask the thread starter if the file name contains spaces. Hehe
Similar to @echo off&setlocal enabledelayedexpansion
if not exist TF md TF
if not exist TP md TP
for /f "delims=" %%i in ('dir /b *.txt') do (
find /c "TF" "%%i"
if !errorlevel!==0 copy "%%i" TF\"%%i"&del /q /f "%%i"
)
copy *.txt TP\*.txt
del /q /f *.txt
Not tested, just take a look first.
|
|
2007-6-14 15:18 |
|
|
joshualaw
初级用户
 
积分 132
发帖 62
注册 2007-6-5
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
文件名跟其它文件名一样的,(这文件名是系统自动产生的), 也试了你刚刚给我最新的但还是不行,能否方便给我你的 email address, 我把相关.TAR 文件发给你帮我看看因为我不知道怎样把那些文件附在这里.先谢拉!
The file name is the same as other file names, (this file name is generated automatically by the system), also tried the latest one you just gave me but it still doesn't work. Can it be convenient to give me your email address? I will send you the relevant.TAR files to help me take a look because I don't know how to attach those files here. Thanks in advance!
|
|
2007-6-14 20:56 |
|
|
wudixin96
银牌会员
    
积分 1928
发帖 931
注册 2007-1-6
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
点引用回复,就可以添加附件了。
@echo off&setlocal enabledelayedexpansion
if not exist TF md TF
if not exist TP md TP
for /f "delims=" %%i in ('dir /b *.txt') do (
findstr /b /r "\<TF\>" "%%i"
if !errorlevel!==0 copy "%%i" TF\"%%i"&del /q /f "%%i"
)
copy *.txt TP\*.txt
del /q /f *.txt
Last edited by wudixin96 on 2007-6-15 at 10:56 AM ]
Click the quote reply to add an attachment.
@echo off&setlocal enabledelayedexpansion
if not exist TF md TF
if not exist TP md TP
for /f "delims=" %%i in ('dir /b *.txt') do (
findstr /b /r "\<TF\>" "%%i"
if !errorlevel!==0 copy "%%i" TF\"%%i"&del /q /f "%%i"
)
copy *.txt TP\*.txt
del /q /f *.txt
Last edited by wudixin96 on 2007-6-15 at 10:56 AM ]
|
|
2007-6-15 00:06 |
|
|
joshualaw
初级用户
 
积分 132
发帖 62
注册 2007-6-5
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
我测试了一下,暂时没有发现问题,还是高手厉害啊,我真的太笨拉,高手,现还有一问题请教,正常的批处理运行时,会在屏幕前闪一下黑色的窗口,能否有办法让批处理在后台运行,不要会在屏幕前闪一下黑色的窗口, 请赐教
I tested it, and for the time being, no problems were found. Still, the experts are amazing! I'm really too stupid. Experts, now there's another question I'd like to ask. When a normal batch file runs, a black window flashes in front of the screen. Is there a way to make the batch file run in the background, without a black window flashing in front of the screen? Please give me some advice.
|
|
2007-6-15 14:53 |
|
|
wudixin96
银牌会员
    
积分 1928
发帖 931
注册 2007-1-6
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
兄台过奖了,其实偶也一菜鸟。刚入门而已。
要隐藏运行批处理,请使用论坛的“搜索”功能。
Brother, you're overpraising. Actually, I'm also a newbie. Just started learning.
To hide the running batch processing, please use the "Search" function of the forum.
|
|
2007-6-15 15:03 |
|
|
lililulula
中级用户
  
积分 302
发帖 138
注册 2007-3-29
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
set batname=WScript.CreateObject("WScript.Shell")
batname.run "batpath",0
保存为vbs脚本运行即可
Last edited by lililulula on 2007-6-15 at 04:35 PM ]
set batname=WScript.CreateObject("WScript.Shell")
batname.run "batpath",0
Just save it as a VBS script and run it.
Last edited by lililulula on 2007-6-15 at 04:35 PM ]
|
|
2007-6-15 16:34 |
|
|
joshualaw
初级用户
 
积分 132
发帖 62
注册 2007-6-5
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
13 楼的意思我还不明白,能否详细说明一下, 我的意思是我用Windows--->Control panel-->Scheduled Task 来排一时间定期运行这一批处理,当运行时,能否有办法让批处理采用"隐藏的方式或其它的方式运行", 总之不要让人看到有黑色屏幕闪烁就行啊,
The meaning of floor 13 I still don't understand. Can you explain it in detail? I mean I use Windows--->Control panel-->Scheduled Task to schedule a time to run this batch regularly. When it runs, is there a way to make the batch run in a hidden way or other ways, in short, don't let people see the black screen flashing.
|
|
2007-6-15 16:50 |
|
|
lililulula
中级用户
  
积分 302
发帖 138
注册 2007-3-29
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
你将上段代码保存成vbs文件,代码里面的batpath为你bat文件的绝对路径,然后计划任务中运行这个vbs脚本
Save the above code as a VBS file. In the code, `batpath` is the absolute path of your bat file, and then run this VBS script in the task scheduler
|
|
2007-6-15 17:09 |
|