# how to rename directories that are hard to type?

How can I rename oddly named directories without typing their full names?

I've got 8 folders with very long foldernames and I only got these folders in this path /home/user/Downloads/ - Is there any command to get every {*.txt} file from all folders and move them to another directory?

• This question is very hard to make sense of. Edit your question to tell us what you have. Then tell us what you want. We may be able to answer that question. – msw Apr 13 '11 at 11:22
• see - I got 8 folders with very long foldernames and I only got these folders in this path /home/user/Downloads/ - I wanted to ask if there is any command to get every txt file of ALL folders and move them to another directory ?! – user14166 Apr 13 '11 at 11:35

find /home/user/Downloads -type f -name \*.txt -print0 | \
xargs -0  -I '{}' mv '{}' nice-directory


will reliably do what you ask.

To rename a directory like horrible *[name]* with\$weird <characters> \\in it" you can use wildcards, for example, if you have only one directory withweird in the name

mv "*weird*" a-regular-named-directory


where the {"} are important. Failing that you can use

ls --hide-control-chars


which will give you a listing with odd characters replaced by ? which is then a shell pattern which you can then mv.

You could just:

mv firstCoupleLetters[tab] newDir[enter]
`

and rely on autocomplete to fill out the original directory name, renaming it to something shorter/more useful.