I have a directories that look like this
fool@brat:/mydir/ucsc_mm8> tar -xvf *.tar
1/chr1.fa.masked
1/chr1_random.fa.masked
2/chr2.fa.masked
3/chr3.fa.masked
4/chr4.fa.masked
5/chr5.fa.masked
5/chr5_random.fa.masked
19/chr19.fa.masked
Un/chrUn_random.fa.masked
What I want to do is to move out all the "*.masked" files in the subdirectories /1
upto /Un
.
Is there a compact way to do it in Linux/Unix?
You can move a file or folder from one folder to another by dragging it from its current location and dropping it into the destination folder, just as you would with a file on your desktop. Folder Tree: Right-click the file or folder you want, and from the menu that displays click Move or Copy.
You need to use the mv command that moves one or more files or directories from one place to another. You must have have write permission for the directories which the file will move between. The syntax is as follows to move /home/apache2/www/html directory up one level at /home/apache2/www/ directory.
To move one or more files: MOVE [/Y | /-Y] [drive:][path]filename1[,...] destination To rename a directory: MOVE [/Y | /-Y] [drive:][path]dirname1 dirname2 [drive:][path]filename1 Specifies the location and name of the file or files you want to move. destination Specifies the new location of the file.
To navigate to your home directory, use "cd" or "cd ~" To navigate up one directory level, use "cd .." To navigate to the previous directory (or back), use "cd -"
The typical way of moving files all files matching a particular expression is
mv 1/*.masked targetDir
where targetDir could be ..
If you want to move it from directories 1,2,3 then you can do something like
mv */*.masked targetDir
Or, if you want to specifically move it from numbered directories, you can just run something like
mv [0-9][0-9]/*.masked targetDir
mv */*.masked .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With