LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 11:27 AM   #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, 03:12 PM   #2
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
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, 04: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, 09: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, 10:09 AM   #5
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,278

Rep: Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694Reputation: 1694
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 10:12 AM.
 
  


Reply



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 08:38 AM
does tar or bzip2 squash duplicate or near-duplicate files? garydale Linux - Software 6 11-19-2009 04:43 PM
Renaming files leupi Linux - General 5 09-16-2008 03:22 AM
help renaming files balistic Linux - Newbie 4 07-29-2007 08:04 AM
renaming files starwarsfan982 Linux - Software 7 10-30-2006 02:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:54 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
Open Source Consulting | Domain Registration