0

Situation: folder1 have about 2000 files, folder2 have over 300 sub-folders and each sub-folder have 500 files. What I'm asking is to move/replace files from /folder1 to /folder2/sub-folders, but only duplicates that are identified by digits, all files start Aaaaaaaa.bbb -.
Also all others file should stay in place.

/folder1   
Aaaaaaa.bbb - 0000125 tag tag_tag 9tag  
Aaaaaaa.bbb - 0000002 tag tag_tag 9tag  
Aaaaaaa.bbb - 0004207 tag tag_tag 9tag  
/folder2/sub-folders  
 /sub1  
Aaaaaaa.bbb - 0000125 tag tag_tag 9tag  
  Aaaaaaa.bbb - 0000935 tag tag_tag 9tag  
 /sub2  
Aaaaaaa.bbb - 0000002 tag tag_tag 9tag  
Aaaaaaa.bbb - 0004207 tag tag_tag 9tag  
Aaaaaaa.bbb - 0000979 tag tag_tag 9tag

Ignore tags, they are different in all cases.

0

I'm not sure what you're asking, but you could do something like this:

Let's say you're in a directory in which you've folders folder1 and files A, B and A123, A456, A789.

You can move a file using the command:

mv A folder1

This moves file A to folder1

mv A* folder1

This moves files A123, A456 and A789 to folder1.

If you want to move those files to a subfolder of folder1, let's say subfolder1, just do:

mv A* folder1/subfolder1
  • folder1 have about 2000 files, folder2 have over 300 sub-folders and each sub-folder have 500 files. What I'm asking is to move/replace files from /folder1 to /folder2/sub-folders, and names are not identical, only part of it Aaaaaaaa.bbb - 0000002 – Ceslovas Nov 3 '15 at 21:57

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.