LinuxQuestions.org
Visit Jeremy's Blog.
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 03-05-2016, 08:29 AM   #1
foreststandalone
LQ Newbie
 
Registered: Mar 2016
Distribution: Linux Mint
Posts: 5

Rep: Reputation: Disabled
Question How to create directory template?


Hi. I'm on Linux Mint. I would like to create directory template for my external hard drive.

Instead of doing it manually, how to do it automatically?

Basically I need mirrored folders (empty) so I can sort my files easier on the laptop. Later on copy and merge them with my backup drive.

--------
English is not my mother tongue, please excuse any errors on my part.
 
Old 03-05-2016, 12:38 PM   #2
ButterflyMelissa
Senior Member
 
Registered: Nov 2007
Location: Somewhere on my hard drive...
Distribution: Manjaro
Posts: 2,766
Blog Entries: 23

Rep: Reputation: 411Reputation: 411Reputation: 411Reputation: 411Reputation: 411
Hi,
Welcome to the forum...I hope it'll be of good use to you
I'd write a shell script yo run every time you bneed the structure...
But...that's me...
Melissa
 
Old 03-05-2016, 03:20 PM   #3
foreststandalone
LQ Newbie
 
Registered: Mar 2016
Distribution: Linux Mint
Posts: 5

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Thor_2.0 View Post
Hi,
Welcome to the forum...I hope it'll be of good use to you
I'd write a shell script yo run every time you bneed the structure...
But...that's me...
Melissa
Die in battle. Live in Valhalla!

The thing is I would need help with that
 
Old 03-05-2016, 03:29 PM   #4
foreststandalone
LQ Newbie
 
Registered: Mar 2016
Distribution: Linux Mint
Posts: 5

Original Poster
Rep: Reputation: Disabled
Or how to copy directories without files?
Through terminal or gui :/
 
Old 03-06-2016, 02:23 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Well, this will find all the dirs under the starting dir
Code:
find startdir -type d
startdir can be a dir under the current dir (aka relative path) or an absolute path eg /home/you/startdir

See http://linux.die.net/man/1/find
 
1 members found this post helpful.
Old 03-06-2016, 06:56 AM   #6
foreststandalone
LQ Newbie
 
Registered: Mar 2016
Distribution: Linux Mint
Posts: 5

Original Poster
Rep: Reputation: Disabled
command

Quote:
Originally Posted by chrism01 View Post
Well, this will find all the dirs under the starting dir
Code:
find startdir -type d
startdir can be a dir under the current dir (aka relative path) or an absolute path eg /home/you/startdir

See http://linux.die.net/man/1/find
It lists subdirectories, thats good... but how to make an empty copy of them? :<
 
Old 03-06-2016, 11:14 AM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,504

Rep: Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489Reputation: 2489
The command below which I found at the askubuntu link below should work. I created the /mnt/test2 directory and ran the command from the /home/user/ directory and it created the directories and subdirectories from the original with no files.

Code:
find -type d -links 2 -exec mkdir -p "/mnt/test2/{}" \;
http://askubuntu.com/questions/36587...ders-not-files

You could test this by creating a test directory with sub-directories with files in them and another test directory in which to create the directories with the command before running it on your system to see if it does what you want.

Last edited by yancek; 03-06-2016 at 11:23 AM.
 
1 members found this post helpful.
Old 03-06-2016, 04:53 PM   #8
foreststandalone
LQ Newbie
 
Registered: Mar 2016
Distribution: Linux Mint
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by yancek View Post
The command below which I found at the askubuntu link below should work. I created the /mnt/test2 directory and ran the command from the /home/user/ directory and it created the directories and subdirectories from the original with no files.

Code:
find -type d -links 2 -exec mkdir -p "/mnt/test2/{}" \;
http://askubuntu.com/questions/36587...ders-not-files

You could test this by creating a test directory with sub-directories with files in them and another test directory in which to create the directories with the command before running it on your system to see if it does what you want.
Thanks a lot! It worked like a charm
That's exactly what I needed.
 
  


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
Active Directory Authentication with custom Homedir Template mithoviel Linux - Desktop 0 08-03-2013 06:44 PM
LXer: How To Create A Debian Wheezy (Testing) OpenVZ Template LXer Syndicated Linux News 0 09-15-2011 02:30 PM
LXer: Create your own Eclipse plug-in template LXer Syndicated Linux News 0 12-31-2008 03:50 AM
openOffice template directory - what is the pathname? TSynergy Linux - Software 4 10-11-2004 09:53 PM

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

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