Wednesday, 12 March 2014

Simple way to copy multiple files under windows

The problem was simple. I had to copy a whole lot of files (from a txt file) from one location to another in order to optimize file structure. I was thinking about using batch scripting but than I realized that the only thing I really need is to use copy.exe. So other stuff like opening file, reading it line by line, parsing the line could be done in some simple manner. So I choose python that I haven't used since collage and give it a try. Phython is simple and all you need to do is just install execution environment, write a couple of line of code and It should work just fine.

So my input was:

So first i had to open the file, splice it to get source and destination file and than just call copy function under windows. This is the result:

You have to have the fil you want to read from saved under same location in order to script to work.

Just open cmd.exe and run command py and wait a bit:)

No comments:

Post a Comment