Find a list of files in directory, move to new, allow duplicates
Greetings. I know enough Unix to be dangerous (!) and know that there is a clever way to do the following and it will save me about a day of agony (this time) and I will use it forever after! (many days of agony saved in the future)!
Basically
I need to find any image files (JPGs, PSDs etc) that contain any one of about 300 different product SKUs in the filename that are within a directory and it's subdirectories and then move them out and into one new directory - on my desktop for example and keep (not over-write) duplicates.
Spelled out in details:
find
I need to search a directory and all it's subdirectories for any filenames that contain a certain set of characters (eg. a filename CP37-BL which might be CP37-BL.jpg or CP37-BL+140806.jpg or there might be several CP37-BL.jpg's in multiple different subdirectories). I have 300 DIFFERENT finds to perform and would love to be able to cut and paste a space or comma separated list or draw from a .txt or .csv file all the different filename portions
eg.
-- any instances that contains any part of that in the filename. The above is 5 of the 300. I would like to run the command 1x not 300x
mv
So, I need to find all those different files and MOVE to a particular target directory - AND allow duplicates (e.g. if there are 2 CP37-BL.jpg files then I want to keep both (appending a _v1 or _copy1 or something to the end of the filename in the case of duplicates.
That's it!
Any thoughts? And THANK YOU in advance!
PS. I am running this in Terminal on Apple OSX 10.9.4
Last edited by jim mcnamara; 08-05-2014 at 12:03 AM..
I need to compare 2 diff type of files and find out the duplicate after comparing each types of files:
Type 1 file name is like: file1.abc
(the extension abc could any 3 characters but I can narrow it down or hardcode for 10/15 combinations).
The other file is file1.bcd01abc (the extension... (2 Replies)
Is this possible? Let me know If I need specify further on what I am trying to do- I just want to spare you the boring details of my personal file management.
Thanks in advance-
Brian- (2 Replies)
I have a directory (and many sub dirs beneath) on AIX system, containing thousands of file. I'm looking to get a list of all directory containing "*.pdf" file.
I know basic syntax of find command, but it gives me list of all pdf files, which numbers in thousands. All I need to know is, which... (4 Replies)
I will be very grateful if someone can help me with bash shell script that does the following:
I have a list of filenames:
A01_155716
A05_155780
A07_155812
A09_155844
A11_155876
that are kept in different sub directories within my current directory. I want to find these files and copy... (3 Replies)
I have a number of files in a directory that can be grouped with something like "ls | grep SH2". I would like to move each file in this list to another directory.
Thanks (4 Replies)
I have have 6 empty directory below. I would like write bash scipt if any files less "1000000000" bytes then move to "/export/home/mytmp/final" folder first and any files greater than "1000000000" bytes then move to final1, final2, final3, final4, final4, final5 and that depend see how many files,... (6 Replies)
Below is the script i have but i would like simplified but still do the same job.
I need a script to copy files not directories or sub-directories into a existing or new directory. The files, if have the same name but different extension; for example 01.doc 01.pdf then only copy the .doc file. ... (1 Reply)
Hi all,
i have a folder, with tons of files containing as following,
on /my/folder/jobs/
some_name_2016-01-17-22-38-58_some name_0_0.zip.done
some_name_2016-01-17-22-40-30_some name_0_0.zip.done
some_name_2016-01-17-22-48-50_some name_0_0.zip.done
and these can be lots of similar files,... (6 Replies)
Hi All,
Daily i am doing the house keeping in one of my server and manually moving the files which were older than 90 days and moving to destination folder.
using the find command . Could you please assist me how to put the automation using the shell script .
... (11 Replies)