Copy files to their relevant directory
Posted: 02 Apr 2009 01:27
Hi Dos Gurus,
I need help to copy files to their relevant directories.
The following files reside in one directory say for example C:\Test\workdir
20090402_000010.csv
20081201_000042.csv
20090301_000081.csv
20090301_000024.csv
20090328_000012.csv
and so on...
The first part of filename is date and the second part holds reference to a directory name where it should be copied into.
i.e. 000010, 000042, 000081 etc.,
If the file name is 20090402_000010.csv then that file should be copied to a directory called C:\Test\000010\indir
and similarly if the filename is 20081201_000042.csv then this will have to go to C:\Test\000042\indir
and so on...
The other possible directories are
C:\Test\000012\indir
C:\Test\000081\indir
C:\Test\000024\indir
C:\Test\000030\indir etc.,
Please advise how do I write a program to copy the files.
Thanks for your valuable time and help.
I need help to copy files to their relevant directories.
The following files reside in one directory say for example C:\Test\workdir
20090402_000010.csv
20081201_000042.csv
20090301_000081.csv
20090301_000024.csv
20090328_000012.csv
and so on...
The first part of filename is date and the second part holds reference to a directory name where it should be copied into.
i.e. 000010, 000042, 000081 etc.,
If the file name is 20090402_000010.csv then that file should be copied to a directory called C:\Test\000010\indir
and similarly if the filename is 20081201_000042.csv then this will have to go to C:\Test\000042\indir
and so on...
The other possible directories are
C:\Test\000012\indir
C:\Test\000081\indir
C:\Test\000024\indir
C:\Test\000030\indir etc.,
Please advise how do I write a program to copy the files.
Thanks for your valuable time and help.