in reply to get file name to create folder
... and UNIX (BASH in this case)
#!/bin/bash for FILE in *.txt do DIR=${FILE##*_} DIR=${DIR/.txt/} [ ! -d $DIR ] && mkdir $DIR mv $FILE $DIR done [download]