I want to move files from Downloads, Documents, Pictures, Music, et al to shared locations. This is for various reasons, including because I want to keep media in a central, shared place.

I want to avoid clobbering existing files with the same name, but if the files have the same size, then I'm usually happy to keep the newer file. Also nice to move files with duplicate names but different sizes, but append something appropriate to the new file.

Anyway, I have a perl script, 'ckmv', which does much of what I want, but I'm wondering whether there is a more idiomatic way in shell script? Do you ever have this need, what do you do?

I just found this post, (how to move files from one folder to other with appending time stamp to the name?), which explains how to forge a new name by appending the file creation date. That makes sense, I may add that.


  • We write scripts, that is the idiomatic way. I mean, AFAIK, there is no utility for this, you could write a bash script but it's not worth the effort if you already have it in perl. – terdon Oct 10 '13 at 2:02
  • I originally wrote a simple bash script, but as I realized I needed to do more checks, I rewrote it in perl. – ChuckCottrill Oct 10 '13 at 23:31
  • I realized that which is why I suggest you keep it there :). Since you have already implemented it, I see no gain in porting it to bash. – terdon Oct 11 '13 at 0:06

I have found fslint to work well for this.

  • 1
    fslint won't copy, it'l just identify and help you rename dupes. – terdon Oct 10 '13 at 3:24

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.