Solved

Show the content of multiple folder into 1

Posted on 2010-08-28
6
436 Views
Last Modified: 2012-05-10
Hi,

I would like to know how can I show the content of multiple folders into one folder on linux.

For an Exemple :

I have the dir "/home/username/folder1" with 2 files in it "file1 and file2"
and I have the dir "/home/username/folder2" with 4 files in it "file10,file11,file12,file13"

what I want is to show "file1" and "file2" into "folder2", I don't want to show the directory "folder1" with ln -s.

Thanks.
0
Comment
Question by:4ToNight
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 33551753
Assuming the two folders are on the same filesystem, you could use a hard link, ie:

ln /home/username/folder1/file* /home/username/folder2
0
 
LVL 1

Author Comment

by:4ToNight
ID: 33551766
oups yeah good solution but I forgot to say, files are not statics.  More files is added every days.

I know I could use this solution with a cron job but I would like something more "Clean".

Thanks!
0
 
LVL 1

Author Comment

by:4ToNight
ID: 33554124
i'm asking this because I have 2 raidz pool, so two samba share, and I would like to show all the files in one so I can delete the other share.
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 2

Accepted Solution

by:
maxalarie earned 500 total points
ID: 34036875
rsync  Folder_1 Folder_2  # This will sync  folder 1 in Folder 2, it will add all Folder_1 files into Folder_2

Unshare Folder_1.

0
 
LVL 2

Expert Comment

by:maxalarie
ID: 34036893
You can also run rsync as a cronjob every night... or every hour.. or even every minute of everyday.

Here is the  Cron syntax:



#Crontab Reference
#       *     *     *   *    *        command to be executed
#       -     -     -   -    -
#       |     |     |   |    |
#       |     |     |   |    +----- day of week (0 - 6) (Sunday=0)
#       |     |     |   +------- month (1 - 12)
#       |     |     +--------- day of        month (1 - 31)
#       |     +----------- hour (0 - 23)
#       +------------- min (0 - 59)

Open in new window

0
 
LVL 1

Author Closing Comment

by:4ToNight
ID: 34450539
thx
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question