-1

This is my Python script:

import json
import csv
import glob
import os
import shlex
import subprocess

os.chdir('C:/ck-master/target')
path='C:/Users/AQ42770/Desktop/congress-android'
for n in range(0,100):

    path1= path+"/"+str(n)

    cmd='java -jar ck-0.3.2-SNAPSHOT-jar-with-dependencies.jar "%s"'
    cmd = cmd % (path)
    args = shlex.split(cmd)
    p = subprocess.Popen(args)

It returns for me 4 CSV files in directory C:\ck-master\target.

The problem is that each time it crushes the 4 CSV files and returns the last result. My expectation is that for each iteration it should move files to another folder and it should name them from 0 to 99.

eyllanesc
  • 235,170
  • 19
  • 170
  • 241

1 Answers1

0

I will answer briefly, cause the question is duplicate.
Task is done with python or cmd directly.
1) Find files in the directory. For example using os.listdir() or glob.glob() methods
2) Copy them using shututil How do I copy a file in Python? or write copy urself. It's simple - jost open the file and write it to new destination with a new name. or move - How to move a file in Python
3) Success

Maks
  • 1,527
  • 1
  • 13
  • 16