2

I have read this Copying multiple specific files from one folder to another which could not help me.

I have thousands of files in /Users/Marine/Desktop/folderGN, some of which I want to keep and some of which I want to move.

There are several files with different names and I want to move only those that have a name containing Protein or MSMS or PSms.

I want to move them from

/Users/Marine/Desktop/folderGN

to

/Users/Marine/Descktop/myfolder 
2

To glob for the different names, you can use a for loop like so

for f in /Users/Marine/Descktop/folderGN/{*[Pp]rotein*,*MSMS*,*PSms*}; do echo mv -v -- "$f" /Users/Marine/Descktop/myfolder ; done

Remove the echo after testing to actually move the files.

I have copied your paths exactly (including the possible typo in Descktop?), but you could instead do this with relative paths:

cd /Users/Marine/Descktop/folderGN
for f in *[Pp]rotein* *MSMS* *PSms* ; do echo mv -v -- "$f" ../myfolder ; done 

(remove echo after testing as before)

| improve this answer | |
0

This is as simple as:

mv /Users/Marine/Descktop/folderGN/*protein* /Users/Marine/Descktop/myfolder/

mv /Users/Marine/Descktop/folderGN/*PSms* /Users/Marine/Descktop/myfolder/

mv /Users/Marine/Descktop/folderGN/*MSMS* /Users/Marine/Descktop/myfolder/

This command is case sensitive. Notice that Descktop should most probably be Desktop, and that Users/Marine is more like a Mac setup, not a Ubuntu one.

| improve this answer | |
0

In a terminal window use the usual mv command: mv /Users/Marine/Descktop/folderGN/*MSMS* /Users/Marine/Descktop/myfolder

repeat for other names (i.e. PSms, etc.) respectively.

| improve this answer | |
0

This is in fact very simple. If you want files with a certain letters/numbers in their name, and anywhere in the name, to be moved to some directory, just:

move *some_name* directory
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.