Skip to main content

structures

## find all files in this directory and its sub-directories and execute mv with target directory . for each file found to move them to current directory.

find . -mindepth 2 -type f -print -exec mv {} . \;

## rename files in subdirs to name dirs (one level)

for x in */*; dodir2=${x%/*}; dir1=${dir2%/*}; dir2=${dir2#"$dir1"}mv -- "$x" "${x%/*}/${dir1}-${dir2}--${x##*/}"done

## find spaces in files

find . -type f -name "* *"

## rename spaces in files

find . -type f -name "* *" | while read file; do mv "$file" ${file// /_}; done

## create folders from list

xargs mkdir <list.txt