LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-16-2014, 12:27 PM   #1
Linux_nublet
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Rep: Reputation: Disabled
renaming duplicate files for achiving


Current student @ Edinburgh Napier University and struggling slightly with renaming duplicate files for archiving

i already have the script with duplicate files matching md5 and sorting by filename, then outputting to a .txt file


stage 2 of the project has to copy over files only named in the IMG_1234.jpg format
so IMG_xxxx.jpg must be 4 numbers after the "_" and all in jpg format


my problem is,when copying over the IMG_ files, if there is an IMG_ file with the same name in that directory, the one being copied must be renamed.

renamed by added .jpg to the end : so IMG_6453.jpg would become IMG_6453.jpg.jpg

Help?

Thanks
 
Old 10-16-2014, 04:12 PM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,836

Rep: Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360
Yep. The coreutils support the --backup parameter, and you can use that in conjunction with --suffix to do what you want.

See here for usage: http://www.gnu.org/software/coreutil...Backup-options

You didn't mention what you were using to copy the files, so I assumed you were using 'cp' itself.
 
Old 10-16-2014, 05:40 PM   #3
Linux_nublet
LQ Newbie
 
Registered: Oct 2014
Posts: 2

Original Poster
Rep: Reputation: Disabled
yes i use the cp command

im new to linux as of september and struggling to find information that i understand

this is for my university coursework and can only use the CLI on Puppylinux. this eliminates the use of tools such as Fdupes

but thanks
 
Old 10-17-2014, 10:41 AM   #4
bradafances9049
LQ Newbie
 
Registered: Oct 2014
Location: видео
Distribution: ElishawepQG
Posts: 1

Rep: Reputation: 0
Clearly, many thanks for the help in this question.

I am ready to help you, set questions. Together we can find the decision.
г
 
Old 10-17-2014, 11:09 AM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 3,836

Rep: Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360Reputation: 1360
Quote:
Originally Posted by Linux_nublet View Post
yes i use the cp command

im new to linux as of september and struggling to find information that i understand

this is for my university coursework and can only use the CLI on Puppylinux. this eliminates the use of tools such as Fdupes

but thanks
That link will take you to the EXACT thing you are asking for, so I don't know why you are talking about Fdupes and dismissing my post.

It says to use 'cp' with --backup and --suffix and gives you an explanation of how to do so. Do you have a question about it? Have you tried it?

Last edited by szboardstretcher; 10-17-2014 at 11:12 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with renaming files EchoPhyber Linux - Newbie 4 03-26-2010 09:38 AM
does tar or bzip2 squash duplicate or near-duplicate files? garydale Linux - Software 6 11-19-2009 05:43 PM
Renaming files leupi Linux - General 5 09-16-2008 04:22 AM
help renaming files balistic Linux - Newbie 4 07-29-2007 09:04 AM
renaming files starwarsfan982 Linux - Software 7 10-30-2006 03:06 PM


All times are GMT -5. The time now is 01:09 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration