我想从文件夹中复制一些东西 [英] i want copy something from a folder
问题描述
大家好,
你好吗:)
i已编写如下代码并保存为.bat文件:
hi all,
how are you :)
i have written a code like this below and saved it like .bat file:
FOR /F %%i IN ('dir Shared_Location_path /b /ad-h /o-d') DO (
SET LS=%%i
GOTO :found
)
echo No subfolder found
goto :eof
:found
echo Most recent subfolder: %LS%
当我在命令提示符下运行此文件时,我得到如下所示的最近文件夹名称,
最近的子文件夹: Some_foledr_name
现在真正的问题是,我想要的nant脚本将进入最近的子文件夹,我在命令提示符中应该选择内容。 ..
请帮帮我,我需要这个......
when i run this file in command prompt, i get the recent folder name like this below,
Most recent subfolder: Some_foledr_name
now the real question is, i want nant script which will go into the Most recent subfolder what i got in the command prompt that should pick the contents in that...
please help me i am need of this......
推荐答案
试试这个:
Try this:
@echo off
Set FOLDER=Shared_Location_path
Set DEST=%FOLDER%\folders.txt
:repeat
FOR /F %%i IN ('dir %FOLDER% /b /ad-h /o-d') DO (
SET LS=%%i
GOTO :found
)
@echo No more subfolders found
goto :finish
:found
echo Most recent subfolder: %LS%
SET FOLDER=%FOLDER%\%LS%
echo %FOLDER% >> %DEST%
goto :repeat
:finish
@echo File: "%DEST%" created.
这有点基本,但它应该帮助深入了解方向。您还可以搜索单独的批处理文件,并使用 CALL
命令执行它。
已修改根据OP的要求。
It's a bit basic, but it should help to drill down through the direcdtories. You could also make the search into a separate batch file and use the CALL
command to execute it.
Modified per OP's request.
这篇关于我想从文件夹中复制一些东西的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!