Results 1 to 5 of 5

Thread: How to copy folder structure without folder contents ?

  1. #1
    Join Date
    Nov 2020
    Beans
    1

    How to copy folder structure without folder contents ?

    Hello and thank you in advance
    I hope you can help me. I'm dual booting and I have a absolute mess of pictures and videos under three large folders 2018, 2019 and 2020 and then divided up by months within those years.

    At this point I want to just copy over the structure without all the contents. -

    Note that the folders are in windows partition.

    in a perfect world you know of a GUI that I can use to copy the whole file structure onto a thumb drive. that way I can put it on another computer where it will all ultimately end up. I really don't want to mess with the command line I've already dinked around with that on the Windows side for a while only ending in frustration.

  2. #2
    Join Date
    May 2010
    Beans
    1,722

    Re: How to copy folder structure without folder contents ?


  3. #3
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: How to copy folder structure without folder contents ?

    It's relatively easy to do it in BASH. Check out BashFAQ #10 (link in my signature).
    Last edited by sisco311; November 15th, 2020 at 12:02 AM.

  4. #4
    Join Date
    Dec 2008
    Location
    Glos, UK
    Beans
    427
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: How to copy folder structure without folder contents ?

    bauton, welcome to the forum.

    Of course, the two replies above use the command line, but don't shy away from it. The help and man assistance make it much more friendly (usually!) than Windows used to be when I was a Windows user.
    The solution cisco offers amounts to this, in 3 steps. (1) go to the top of the folder tree whose structure you want to copy (2) get a list of all the folders, remembering their place in the structure (3) feed this list into cpio which recreates the folder tree at the nominated destination.

    If you are nervous, try it out on a small scale first, perhaps creating a brand new destination folder for the purpose. I know I would!
    There are more irrational numbers than there are digits in the full expansion of pi.

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: How to copy folder structure without folder contents ?

    I would use find with mkdir -p
    1. cd {top of directory structure to be cloned}; # being in the directory is ABSOLUTELY critical.
    2. find . -type d -print -exec mkdir -p "$TARGET/{}" \;
    find - exec can be slow. Usually, I'd use xargs with it, but I didn't feel like looking up how to use xargs where their wasn't a space in the $TARGET/{} part.

    Or I'd check gnutar for a way to create a tar archive with just directories (tar cvf), no files, do that, then de-tar (tar xvf) in the new directory area. I don't know if this is possible or not. 5 minutes of google. https://stackoverflow.com/questions/...tory-structure

    Or I'd just use rsync to clone everything, but limit the size of all files to 4K or less. I know rsync has an option to restrict by file size. Generally, I use it to prevent getting huge (2GB+) files, but it could be useful for this. https://www.cyberciti.biz/faq/unix-l...s-trees-rsync/

    Those are off the top of my head. I didn't test any. I'd setup a 2-20 directory test area to play and test.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •