How to copy files to special directories
Posted: 03 Aug 2009 11:02
I have a picture library with more than 1000 pictures. Let's say that the location is "C:\pic_lib\" with for example these pictures:
pic001.jpg
pic002.jpg
pic003.jpg
(..).jpg
And I have some text files called
group1.txt
group2.txt
group3.txt
(..).txt
Each textfile has per line a location to a group of pictures. For example group1.txt has somethink like:
C:\pic_lib\pic001.jpg
C:\pic_lib\pic003.jpg
C:\pic_lib\pic006.jpg
etc.
I'd like to make a script to copy all the pictures that are in each text file to a new directory. The name of the directory should be the name of the text file. I already started to make something in a batch file, but this program is not doing the right think. All pictures that were listed in the text files were send to all directories.
Do you have any idea how to solve this problem?
pic001.jpg
pic002.jpg
pic003.jpg
(..).jpg
And I have some text files called
group1.txt
group2.txt
group3.txt
(..).txt
Each textfile has per line a location to a group of pictures. For example group1.txt has somethink like:
C:\pic_lib\pic001.jpg
C:\pic_lib\pic003.jpg
C:\pic_lib\pic006.jpg
etc.
I'd like to make a script to copy all the pictures that are in each text file to a new directory. The name of the directory should be the name of the text file. I already started to make something in a batch file, but this program is not doing the right think. All pictures that were listed in the text files were send to all directories.
Code: Select all
@echo off
set PIC_LIB="C:\pic_lib"
set GROUPS=group1.txt group2.txt group3.txt
for %%A in (%GROUPS%) do (
mkdir %%~nA
for /F %%B in (%GROUPS%) do (
copy %PIC_LIB%\%%B "%%~nA\%%B"
)
)
Do you have any idea how to solve this problem?