or Connect
AppleInsider › Forums › Software › Mac Software › File names changed to folders??
New Posts  All Forums:Forum Nav:

File names changed to folders??

post #1 of 2
Thread Starter 
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?
Gino J. Piazza
Port Chester, NY
Reply
Gino J. Piazza
Port Chester, NY
Reply
post #2 of 2
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:

Code:


import os
import sys

if(len(sys.argv)<3):
>print "specify input and output directory"
>sys.exit()

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 filestofolders.py. Then open a terminal and type:

python <drag filestofolder.py 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.
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Mac Software
AppleInsider › Forums › Software › Mac Software › File names changed to folders??