File names changed to folders??

in Mac Software edited January 2014
Does anyone know of an application or utility that will:

- copy a list of file names,

- then output that list of file names to folders with corresponding names in a new window as to not overwrite the files?


  • Reply 1 of 1
    MarvinMarvin Posts: 14,219moderator
    You wouldn't get an app to do it. You might get an Automator workflow but a script is easier. Try the following Python script:


    import os

    import sys


    >print "specify input and output directory"


    dirin = sys.argv[1]

    dirout = sys.argv[2]

    for root, dirs, files in os.walk(dirin):

    >for f in files:

    >>if(f.startswith('.')): continue

    >>newfolder = dirout+"/"+f

    >>print "making "+newfolder

    >>os.system("mkdir '%s'" %(newfolder))

    Paste that into a plain text document, change the > to tabs and save as Then open a terminal and type:

    python <drag here> <drag folder of files here> <drag output folder here>

    Just drag the files and folders onto the terminal window in that order and hit return. It will tell you what it's doing. The mkdir command by default checks if a file or folder exists and won't overwrite.
Sign In or Register to comment.