Skip to main content

Thread: move files recursively to new folders with the same name as the file?


hi,

how can move files recursively new folders same name file

example

have folder containing 500 files various names same extension .txt

need make 500 new folders same names of files move 500 files folders.

i think can simple parameter expansion , loop, sort of like:

code:
#!/bin/bash  file in file*.txt     dir="${file%.*}"     echo mv "$file" "${dir}/${dir}.txt" done
a couple notes...change 'file*.txt' match have. might use '*.txt'. also, i've left echo statement in there testing purposes. show moved, not move. when you're satisfied how it's working, remove word 'echo' , let loose.


Forum The Ubuntu Forum Community Ubuntu Official Flavours Support General Help [SOLVED] move files recursively to new folders with the same name as the file?


Ubuntu

Comments

Popular posts from this blog

Could not place because the source rectangle is empty

Thread: Using smartcard reader with vpnc

Adobe Font Folio 7.0 or just 7?