Personal tools

svg.py

svg.py — Python Source, 0Kb

File contents

'''
this file tries to tract down all the svg and associated files in a directory
'''
import os
import re

path = '/media/Data/Documents/School/'
os.system('find ' + path + ' -name "*.svg">>svg.txt')

f = open('svg.txt', 'r')

for line in f:
    splitpath = line.split('/')
    pathtofile = '/' + '/'.join(splitpath[1:-1]) + '/'
    filename = splitpath[-1][:-1]
    os.system('cp "' + pathtofile + filename + '" /home/moorepants/Desktop/svg/')
    os.system('cp "' + pathtofile + filename[:-3] + 'png" /home/moorepants/Desktop/svg/')
    svgfile = open(pathtofile + filename)
    for v in svgfile:
        found = re.search('\.JPG', v)
        if found:
            splitline = v.split('/') # gets the linux files
            #splitline = v.split('\\') # gets the microsoft files
            embedfile = splitline[-1][:-2]
            test = str(pathtofile + embedfile)
            os.system('cp "' + test + '" /home/moorepants/Desktop/svg/')
Document Actions