Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 443
  • Last Modified:

Show the content of multiple folder into 1


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.

  • 3
  • 2
1 Solution
Assuming the two folders are on the same filesystem, you could use a hard link, ie:

ln /home/username/folder1/file* /home/username/folder2
4ToNightAuthor Commented:
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".

4ToNightAuthor Commented:
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.
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

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.

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

4ToNightAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now