📜  使用 javascript 代码示例破解计算机

📅  最后修改于: 2022-03-11 15:01:19.131000             🧑  作者: Mango

代码示例1
#figure out where we're going
dest = destPath + root.replace(sourcePath, '')

#if we're in a directory that doesn't exist in the destination folder
#then create a new folder
if not os.path.isdir(dest):
    os.mkdir(dest)
    print 'Directory created at: ' + dest

#loop through all files in the directory
for f in files:

    #compute current (old) & new file locations
    oldLoc = root + '\\' + f
    newLoc = dest + '\\' + f

    if not os.path.isfile(newLoc):
        try:
            shutil.copy2(oldLoc, newLoc)
            print 'File ' + f + ' copied.'
        except IOError:
            print 'file "' + f + '" already exists'