2
as I create a ".bat" to move all files in specific or better only those with extension ".txt" from one directory and all its subdirectories to another folder.
2
as I create a ".bat" to move all files in specific or better only those with extension ".txt" from one directory and all its subdirectories to another folder.
2
As I’m not sure I understand correctly, then we have 2 ways to solve your problem.
The form below will copy all files with the extension and subfolders to the destination and create the same folders where the files with the extension were:
Solução 1
xcopy c:\*.txt d:\textos /sy
/s will make it "recursive"
/y asks if you want to replace.
Solução 2
For each file in the directory c:\
and subdirectories /R
that match the pattern (.*txt
) will put the file name in the variable %%f
, then for each file to the destination d:\textos
, that is, all files .*txt
that find no matter the subfolder, ira all to d:\textos
, if there is repeated name will replace.
for /R c:\ %%f in (*.txt) do copy %%f d:\textos
/R traverse subdirectories.
Browser other questions tagged windows script batch
You are not signed in. Login or sign up in order to post.