I need a batch file copy folders from a list

August 20, 2010 at 06:13:47
Specs: Server 2003
i have a notepad file with a list of folder names. what i need is a batch file that will read from the text file and copy the folders and move it to a different directory then delete the folder afterwords. the folders are
E:\Student Home Directories\ESHomeDir
and needs to move to
E:\Student Home Directories\HS
the text file will be located in
E:\Student Home Directories\ES_Student_Dir _2B_deleted.txt

Thanks in Advance
and i plan on placing the batch file in the same directory
E:\Student Home Directories\


See More: I need a batch file copy folders from a list

Report •


#1
August 21, 2010 at 15:59:33
And what does this "E:\Student Home Directories\ES_Student_Dir _2B_deleted.txt" look like?

Report •

#2
August 22, 2010 at 23:43:57
If the Text file has the is whole this would work:

@echo off
setLocal EnableDelayedExpansion
pause
for /f "tokens=* delims= " %%a in (E:\Student Home Directories\ES_Student_Dir _2B_deleted.txt) do (
set /a N+=1
del "%%a" /s /q
)


But if it's just a part

@echo off
setLocal EnableDelayedExpansion
pause
for /f "tokens=* delims= " %%a in (E:\Student Home Directories\ES_Student_Dir _2B_deleted.txt) do (
set /a N+=1
del "E:\Student Home Directories\%%a" /s /q
)

Note that it reads it line by line

/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nom Nom Nom
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\


Report •

#3
August 23, 2010 at 06:15:15
the notepad names are sorted line by line

Report •

Related Solutions

#4
August 23, 2010 at 07:24:40
the .txt looks like this

awagner
awertley
bwaterland


Report •

#5
August 23, 2010 at 09:02:35
md HS 2>NUL
for /f "delims=" %%a in (ES_Student_Dir _2B_deleted.txt) do move "ESHomeDir\%%a" HS


Report •


Ask Question