parent and child folders with same name

Discussion related to "Everything" 1.5 Alpha.
Post Reply
Terka
Posts: 23
Joined: Sun Oct 16, 2016 3:12 pm

parent and child folders with same name

Post by Terka »

hi,
if i extract a zip file, sometimes it has a folder in the archive, sometimes not.
After extract the structure can look like:
\pictures\pictures\001.jpg
\pictures\pictures\002.jpg
can i somehow identify such
parent and child folders with same name
and simplify the structure to:
\pictures\001.jpg
\pictures\002.jpg
Thank you!
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: parent and child folders with same name

Post by NotNull »

To find those folders, paste the following in the Everything search bar:

Code: Select all

regex:^(.*)\\([^\\]*)\\\2$ 

Warning: Test the following thoroughly on some dummy-data before using it on your real data.

To move the content of "c:\path to\folder1\folder1" to "c:\path to\folder1":
  • Use the search mentioned above to find all "folder1\folder1" folders
  • Select all folders you want to move
  • Menu:Edit => Advanced => Advanced Move to Folder
    (The Move To dialog will open)
  • Enable Regular expressions
  • Old format =
    ^(.*)\\[^\\]*$
  • New format =
    \1

    Example:
    2023-02-28 19_26_44-Move To.png
    2023-02-28 19_26_44-Move To.png (17.62 KiB) Viewed 1545 times
  • Check the New Full Paths
  • OK
    (the actual renaming will start; a Confirm Folder REplace dialog will be shown)
    2023-02-28 19_29_32-Confirm Folder Replace.png
    2023-02-28 19_29_32-Confirm Folder Replace.png (18.74 KiB) Viewed 1545 times
  • Click Yes for each separate folder (or enable Do this for all current items too)
  • Done
therube
Posts: 4985
Joined: Thu Sep 03, 2009 6:48 pm

Re: parent and child folders with same name

Post by therube »

If you don't have name collisions, you can search for:
\pictures\pictures\ *.jpg

select them all
then Parent -> Paste to the (parent) \pictures\ directory.

(Or, Edit | Move to Folder...)

---

A Zip can have a (can be created with a) directory structure, or not.

You can choose to Extract without directory structure
or to eXtract with directory structure.
(Well, depending on your un-zip program. Below is from various programs.)

Code: Select all

  e: Extract files from archive
  x: eXtract files with full pathname

  e : Extract files from archive (without using directory names)
  x : eXtract files with full paths
  
  -j  junk paths (do not make directories) [from unzip]

  e             Extract files without archived paths
  x             Extract files with full path

---


(Related, depending on a particular situation), Merge Directory Structures
Terka
Posts: 23
Joined: Sun Oct 16, 2016 3:12 pm

Re: parent and child folders with same name

Post by Terka »

Hi NotNull, thank you very much!!!
Great guideline.

(Not needed to confirm the folder merge.)
Once again, thank you, you made my day!
NotNull
Posts: 5461
Joined: Wed May 24, 2017 9:22 pm

Re: parent and child folders with same name

Post by NotNull »

You're welcome!
Terka wrote: Tue Feb 28, 2023 10:19 pm thank you, you made my day!
And that .. made *my* day too :D Thanks!
Post Reply