LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 08-18-2017, 01:08 AM   #16
ericlindellnyc
Member
 
Registered: Jun 2017
Posts: 88

Original Poster
Rep: Reputation: Disabled
Appending incrementing number to directory name.


Quote:
Originally Posted by Laserbeak View Post
So if you have a directory /path/to/some/of/my/really/cool/computer/files you want to move of/my/really/cool/computer/files to /path/to/cool/computer/files? What if there's a directory with that name already there? Merge them, or rename it by adding 1, 2, 3 etc.?
Laserbeak, thanks for the reply, and please excuse my delay in responding.

Yes, this is exactly the idea. I figured out (I think) how to "transplant" all directories at level 10 to level 3 (or whatever) -- with a simple mv.

But the problemo, as you observe, is name duplicates. I'd prefer to rename by appending incrementing number, though merging would probably work, too.

I've been using this, which unfortunately does not address duplicates:

CODE
find -maxdepth 10 -mindepth 10 -type d in ./* -exec echo mv -i

BACK TO TEXT
If you can suggest how to modify directory names to avoid collisions, that would help a lot.

Thanks much for your help with this.

Eric
 
Old 08-18-2017, 01:22 AM   #17
ericlindellnyc
Member
 
Registered: Jun 2017
Posts: 88

Original Poster
Rep: Reputation: Disabled
THANK YOU ALL FOR YOUR HELPFUL REPLIES.

I actually wrote a more detailed reply for each of your various approaches, but unfortunately it got zapped by accident, and it's too late for me to redo.

I'm going with appending incrementing number to avoid directory name collisions.

I might also try (if that doesn't work) combining path and filename into one filename.

Thank you again for your help, and please excuse my absence for the last month.

Eric
 
  


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
LXer: Refactoring Deeply Nested Code LXer Syndicated Linux News 0 08-17-2011 04:10 AM
creating a link to a deeply nested folder like ~ = /home/username/ AlphaLexman Linux - Newbie 9 09-17-2009 06:31 PM
Convert directory structure from long file names in Linux to DOS 8.3 structure? manorina Linux - Software 5 09-12-2009 09:18 AM
Home Jail Folder Structure like Gobolinux Directory Structure luispt Linux - General 3 07-26-2008 06:46 PM
LXer: Retain and recall long paths with rr utility LXer Syndicated Linux News 0 10-16-2007 06:42 PM

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

All times are GMT -5. The time now is 05:21 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