Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script to move files up a directory

Status
Not open for further replies.

tehon3299

Programmer
Aug 30, 2006
4
US
Hey all,

I am looking for a quick script (shell, perl, anything) that will take all files in any subfolder and move it up 1 directory. Example...The layout of /home/blah/ is:
test1/
test2/
test3/
test4/

and there is a file in each of those directories, ie...

test1/test1.txt
test2/test2.txt
test3/test3.txt
test4/test4.txt

I want to move all the .txt files to /home/blah/.

Any Help??

Thanks!!
 
Something like this ?
cd /home/blah
mv */*.txt .

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top